GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
std::experimental::basic_string_view::operator[](3) C++ Standard Libary std::experimental::basic_string_view::operator[](3)

std::experimental::basic_string_view::operator[] - std::experimental::basic_string_view::operator[]


constexpr const_reference operator[](size_type pos) (library fundamentals TS)
const;


Returns a const reference to the character at specified location pos.


No bounds checking is performed: the behavior is undefined if pos >= size().


pos - position of the character to return


Const reference to the requested character


Does not throw


Constant.


Unlike std::basic_string::operator[], basic_string_view::operator[](size()) has
undefined behavior instead of returning CharT().

// Run this code


#include <iostream>
#include <experimental/string_view>
int main()
{
std::string str = "Exemplar";
std::experimental::string_view v = str;
std::cout << v[2] << '\n';
// v[2] = 'y'; // Error: cannot modify through a string view
str[2] = 'y';
std::cout << v[2] << '\n';
}


e
y


at access specified character with bounds checking
(public member function)

2022.07.31 http://cppreference.com

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.