basic_string::const_pointer

提供指向在字符串的 const 元素的类型。

typedef typename allocator_type::const_pointer const_pointer;

备注

类型为 allocator_type::const_pointer的同义词。

对于 字符串类型,它与 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 类