Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-09-04 07:10:01


> >Wrapping should not be necessary. The point is that to_ptr is sufficient;
> >copy_to and any_cast can be implemented in terms of to_ptr.
>
> Indeed, they are. But they are also sufficiently useful in their own
> right to warrant inclusion.

It is not the inclusion itself I am discussing, but its form. any_cast is a
free function, why not make copy_to a free function as well?

> >This makes copy_to even more generic.
>
> I don't see that this actually buys me very much.

Offhand I don't see the exact benefits either, but the users may find an use
for this idiom. Genericity is good, unless there are strong reasons against
it.

> Sorry to be cynical, but in most cases deprecated is another way of
> saying "permanent" -- ever heard the refrain "just hack it for now, but
> we'll come back and fix it later"? >:->

You are right - in principle - but in this particular case, I have to
disagree. to_ptr<T>() is the documented interface. All proper compilers
accept it. All users not forced to use an inferior compiler should use it.

to_ptr((T*)0) is an unsupported 'hack' for MSVC users only; and while
definitely 'ugly', it does no harm to the 'any' concept.

> >No, this is a strict weak ordering on the <type, value> pair. How else
would
> >you make std::set<ref> work?
>
> By providing my own function object type.

You're still free to do that, if you don't like the default. If you can
propose a better default, I'll be glad to consider it.

--
Peter Dimov
Multi Media Ltd.

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