public member function

std::string::get_allocator

<string>
allocator<char> get_allocator( ) const;
Get allocator
Returns the allocator object used to construct the object.

Allocators define memory allocation models. For string objects this is an object of the standard allocator type for char elements: allocator<char>, which is value independent, but basic_string objects may specify different allocator types as a template parameter of the class template, and different values for them on object construction.

Parameters

none

Return Value

The allocator value.

Basic template member declaration

( basic_string<charT,traits,Allocator> )
1
2
typedef Allocator allocator_type;
allocator_type get_allocator() const;