std::string exorcism hiccup

Phil Edwards phil@jaj.com
Sat Jun 15 03:53:00 GMT 2002


On Thu, Jun 13, 2002 at 06:29:06PM +1200, Tony Bryant wrote:
> As recommended by listers, I've been going through my project attempting
> to replace 
> 
> std::string 
> 
> with 
> 
> std::basic_string<char,std::char_traits<char>,myallocator<char> >

As an aside, I wonder if there can be a member template copy constructor that
allows basic_string's of the same character type, but different allocator
types, to copy data to/from each other.  [17.4.4.4]/2 allows the practice,
[21.3] doesn't prohibit the signature, [14.5.2] would seem to allow it,
but I don't know whether [12.8]/3 doesn't kill the idea.  (The example
given in the text doesn't make a whole lot of sense to me.)

That way

    std::string                                      a;
    ...
    std::basic_string<char,....., something_weird>   b (a);

would work.

I'll experiment with this once the ol' RSI lets up next week.  :-)


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams



More information about the Libstdc++ mailing list