[ Web Proxy ]
URL:
Viewing: http://ru.cppreference.com/cpp/string/basic_string/begin [Back]  [Original]

std::basic_string<CharT,Traits,Allocator>::begin, std::basic_string<CharT,Traits,Allocator>::cbegin cppreference.com
cppreference.com

std::basic_string<CharT,Traits,Allocator>::begin, std::basic_string<CharT,Traits,Allocator>::cbegin

cppreference.com
 
C++
(C++20)
(C++20)
(C++11)
(C++20)
/
(C++11)
(C++11)
(C++11)
(C++17)
 
 
std::basic_string
-
(C++17)
,
/
( C++20)( C++20)( C++20)( C++20)( C++20)(C++20)
(C++11)(C++11)(C++11)
(C++11)(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
 
<tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody> <tbody class="t-dcl-rev t-dcl-rev-num "> </tbody><tbody> </tbody>
(1)
iterator begin();
( C++11)
iterator begin() noexcept;
( C++11)
( C++20)
constexpr iterator begin() noexcept;
( C++20)
(2)
const_iterator begin() const;
( C++11)
const_iterator begin() const noexcept;
( C++11)
( C++20)
constexpr const_iterator begin() const noexcept;
( C++20)
(3)
const_iterator cbegin() const;
( C++11)
const_iterator cbegin() const noexcept;
( C++11)
( C++20)
constexpr const_iterator cbegin() const noexcept;
( C++20)

.

begin() mutable , *this.

cbegin() . const_cast<const basic_string&>(*this).begin().

()

.

.

libstdc++, cbegin() C++98.

#include <iostream>
#include <string>

int main()
{
    std::string s("Exemplar");
    *s.begin() = 'e';
    std::cout << s << '\n';
    
    auto i = s.cbegin();
    std::cout << *i << '\n';
//  *i = 'E'; // : i  
}

:

exemplar
e

C++:

LWG 1192 C++98 std::basic_string - cbegin()


(public -) []

(public - std::basic_string_view<CharT,Traits>) []

Web Proxy Viewer  |  New URL  |  Original Page