Boost logo

Boost Users :

From: Marc Mutz (marc_at_[hidden])
Date: 2006-02-13 15:03:20


On Monday 13 February 2006 20:08, Delfin Rojas wrote:
> According to the documentation of boost::any_cast<T>, "if T is a reference
> to (possibly const qualified) ValueType, it [boost::any_cast] returns a
> reference to the held value."

Right. But this is still inconsistent both with variant's get<> and e.g.
static_cast<>. The static_cast<> behaviour can't be done in current C++
(since you can't partially specialise function templates), so maybe variant's
get<> should be changed?

Hmm, maybe I lied when I said static_cast<> syntax is not possible... Lemme
try. This should give static_cast<> semantics for any_cast (ie. <T> cast by
value, <T&> by reference, and <T*> by pointer).

Hmm, the attached stuff works, but how would const char* work in this
setting...?

Marc

-- 
Marc Mutz -- marc_at_[hidden], mutz_at_[hidden]
phone: +49 521 521 45 45; mobile: +47 45 27 38 95
Klarälvdalens Datakonsult AB, Platform-independent software solutions



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