basic_string::const_pointer

文字列の const 要素へのポインターを提供する型。

typedef typename allocator_type::const_pointer const_pointer;

解説

型は allocator_type::const_pointerのシノニムです。

stringごとに、char*と同じです。

宣言した定数であるポインターは、宣言時に初期化されなければなりません。 const ポインターは同じメモリ位置を常に置き、定数または定数ではないデータを指す場合もあります。

使用例

// basic_string_const_ptr.cpp
// compile with: /EHsc
#include <string>
#include <iostream>

int main( ) 
{
   using namespace std;
   basic_string<char>::const_pointer pstr1a = "In Here";
   const char *cstr1c = "Out There";

   cout << "The string pstr1a is: " << pstr1a <<  "." << endl;
   cout << "The C-string cstr1c is: " << cstr1c << "." << endl;
}
  

必要条件

ヘッダー: の <文字列>

名前空間: std

参照

関連項目

basic_string クラス