C++ 字串庫 - cbegin



描述

它返回指向開頭的 const_iterator。

宣告

以下是 std::string::cbegin 的宣告。

const_iterator cbegin() const noexcept;

C++11

const_iterator cbegin() const noexcept;

引數

返回值

它返回指向字串開頭的 const_iterator。

異常

從不丟擲任何異常。

示例

以下是 std::string::cbegin 的示例。

#include <iostream>
#include <string>

int main () {
   std::string str ("Tutorials Point");
   for (auto it=str.cbegin(); it!=str.cend(); ++it)
      std::cout << *it;
   std::cout << '\n';

   return 0;
}

示例輸出應如下所示:

Tutorials Point 
string.htm
廣告
© . All rights reserved.