Boost logo

Boost :

From: Aleksey Gurtovoy (alexy_at_[hidden])
Date: 2000-02-16 03:22:23


Dave Abrahams <abrahams_at_[hidden]> wrote:
> You're no doubt correct. Of course, it doesn't make much sense to have a
> function called boost::geometry2d::make_point converting _from_
> boost::geometry2d::point _to_ something else.
>
> I was thinking something like boost::explicit_cast<> could be made to
work.

I like the idea of having a special kind of cast notation for such kind of
conversions. In fact, I've been waiting for such idea for a while :). I'm
tired to always remember the way in which every concrete class can convert
itself to another class. If it does such conversions not through conversion
operators (for good reasons, of course), things become rather messy as the
number of such classes are growing.. E.g., you could have a
std::stringstream::str(), your_lib::cistring::cpp_str(),
their_lib::variant::as_string() etc. As for me, I would prefer always to
write something like:

sdt::string str = boost::conversion_cast<std::string>( something );

and don't care much about the name of conversion member function which are
used behind scene.
Does that make sense for anybody besides me? :)

-Alexy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk