On Tue, Aug 16, 2011 at 8:11 AM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> wrote: > On 16 August 2011 12:54, Jeffrey Walton <noloader@xxxxxxxxx> wrote: >> On Mon, Aug 15, 2011 at 7:43 PM, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> 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 > CopyConstructible. > > >> 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. I recall the price was inexpensive. My problem was that I did not want to give up a credit card. Laws and protections in the US are a joke, and a citizen in another country has even fewer protections and recourse. I believe I was the later - a US citizen making a foreign purchase. Anyway, these standards should be free since they are worldwide (at least as electronic versions). Its the cost of doing business. Jeff