_Alloc_hider?

Jeffrey Walton noloader@gmail.com
Tue Aug 16 11:55:00 GMT 2011


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
better, does GCC publish a specification? (I don't have a bootleg copy
of the ISO/IEC copyrighted material).

Jeff



More information about the Gcc-help mailing list