From: Mark Rodgers (mark.rodgers_at_[hidden])
Date: 2000-09-03 04:48:21
Very nice. I did notice a couple of little things:
1. Your operator= binds a non-const reference to a temporary in
the call to swap. Please change to
any & operator=(const any & rhs)
2. Your implementations of const and non-const versions of to_ptr
are the wrong way round. In the const version, you cast away
constness leading to undefined behaviour. You should put the
work in the const version and cast away the constness of the
return value in the non-const version.
3. I have a question mark over the implementation of to_ptr. If
const int *pi = a.to_ptr<const int>();
then it seems to me that I'll be casting content to
holder<const int>, even though it's actually a holder<int>.
Perhaps you need to use remove_const from type_traits
in your cast.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk