C++ 字串庫 - cend



描述

它返回一個指向字串末尾之後的 const_iterator。

宣告

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

const_iterator cend() const noexcept;

C++11

const_iterator cend() const noexcept;

引數

返回值

它返回一個指向字串末尾之後的 const_iterator。

異常

從不丟擲任何異常。

示例

以下為 std::string::cend 的示例。

#include <iostream>
#include <string>

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

   return 0;
}

示例輸出應如下所示:

tutorialspoint india PVT Ltd
string.htm
廣告

© . All rights reserved.