Jonathan Wakely jwakely.gcc@gmail.com
Tue Aug 16 12:11:00 GMT 2011

On 16 August 2011 12:54, Jeffrey Walton <noloader@gmail.com> wrote:
> On Mon, Aug 15, 2011 at 7:43 PM, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>> On 16 August 2011 00:30, Jeffrey Walton wrote:
>>> Hi All,
>>> I'm testing a custom allocator. The allocator works well with vector,
>>> but fails to link with basic_string (see below).
>>> I looked through Stroustrup and could not find info on _Alloc_hider.
>> It starts with an underscore followed by an upper case letter, so it's
>> in the implementation namespace i.e. it's an implementation detail, so
>> you're not going to find it in a book.
>> [SNIP]
>>> How does one one provided an allocator for use by a basic_string?
>> By writing a type that meets the C++03 Allocator requirements, which
>> yours doesn't.
>> If you look at the source you'll see that _Alloc_hider is a type
>> derived from the string's allocator_type, which is done to benefit
>> from the Empty Base Optimization.  Since it is derived from the
>> string's allocator type, it is convertible to the allocator type,...
> Forgot to ask.... What are the C++03 retirements being violated? Or

Your type isn't CopyConstructible because the copy constructor is explicit.

basic_string::get_allocator() returns by value, which requires

> better, does GCC publish a specification? (I don't have a bootleg copy
> of the ISO/IEC copyrighted material).

Why would it have to be a bootleg copy?
You can buy legal copies electronically or as a book.

More information about the Gcc-help mailing list