Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2000-09-04 09:30:33

> >to_ptr((T*)0) is an unsupported 'hack' for MSVC users only; and while
> >definitely 'ugly', it does no harm to the 'any' concept.
> Judging by the recent discussion re VC7 it is a long term hack. If
> someone wished to make their code portable, they would rely on that
> hack, and away you go: permanence.

We'll have to ask somebody with access to VC7 to try the a.to_ptr<T>()
syntax. VC6's inability to handle it is a parser problem that might be fixed
in 7.

> >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.
> The point I am making is that there is no reasonable default, therefore
> one should not be provided. For the same reason that type_info does not
> support operator<, neither should ref. operator== makes sense, but
> unless you actually have a proper ordering, operator< should be omitted
> in favour of providing the user with a named, documented ordering
> function object type.

I want to be able to compare ref's that hold values of the same type via
operator<, hence the default semantics. Also, the ability to use ref as a
map key is a good thing, IMHO.

(This applies to any as well.)

As an aside, what are the reasons that type_info::op< is spelled before()?

Peter Dimov
Multi Media Ltd.

Boost list run by bdawes at, gregod at, cpdaniel at, john at