다음을 통해 공유


basic_string::const_pointer

A type that provides a pointer to a const element in a string.

typedef typename allocator_type::const_pointer const_pointer;

설명

The type is a synonym for allocator_type::const_pointer.

For type string, it is equivalent to char*.

Pointers that are declared const must be initialized when they are declared. Const pointers always point to the same memory location and may point to constant or nonconstant data.

예제

// 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;
}
  

요구 사항

헤더: <string>

네임스페이스: std

참고 항목

참조

basic_string 클래스