Subject: Re: [boost] [variant]compile-time-checked boost::get<T>?
From: David Abrahams (dave_at_[hidden])
Date: 2008-12-10 13:57:27
on Wed Dec 10 2008, Arno SchÃ¶dl <aschoedl-AT-think-cell.com> wrote:
> I just replaced our own union implementation by boost::variant and was surprised that
> boost::get<T> does not compile-time check T. IMHO, boost::get<T> should only compile
> if T is a possible member of the variant. We implemented this with an enable_if
> without much difficulty.
> As a further extension, boost::get<S> where S is a base class of a T
> contained in the variant, should also work. I believe this would also
> be implementable with enable_if/disable_if, but we have not done it,
> so no guarantee.
I agree with you, FWIW
-- Dave Abrahams BoostPro Computing http://www.boostpro.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk