Boost logo

Boost Users :

Subject: Re: [Boost-users] automatic conversion between boost::container::string and std::string
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-11-17 16:29:08


El 17/11/2011 18:31, Yi Ding escribió:
> Hi,
>
> Thanks for the new containers library. There's a lot of useful stuff
> in there. I was wondering: is it possible to do automatic conversion
> between boost::container::string and std::string? A lot of libraries
> currently use std::string.
>
> Thanks,
> Yi

Automatic conversion is not usually a good idea. I guess you can use
std::string(boost_string.c_str());

Maybe we could do an ugly hack to move memory allocated with std::string
to boost::container::string, avoiding costly copies, but that of course,
would require playing with underfined behaviour.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net