
10 Dec
2008
10 Dec
'08
6:57 p.m.
on Wed Dec 10 2008, Arno Schödl <aschoedl-AT-think-cell.com> wrote:
Hello,
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