|
Boost : |
From: Joel de Guzman (joel_at_[hidden])
Date: 2006-05-07 21:29:06
Gennadiy Rozental wrote:
> I may not have time for review, but just one simple question: what are the
> advantages/disadvantages/differences in usage with
> stl_container<boost::variant>?
Hi,
Here's another compelling reason why you'd use tuples:
Try to implement Boost.Parameter or Boost.Bind or
Boost.Lambda using std::vector<variant>. You can't!
The types are unbounded. Variant can only deal with
bounded types.
From the variant docs:
'''
A discriminated union container on some set of types is
defined by instantiating the boost::variant class template
with the desired types. These types are called *bounded types*
'''
emphasis mine.
But really, is this a review of tuples again? I think we are
comparing apples and oranges again. tuples and variants are
different tools for different tasks. Sure you can use a hammer
to drive a screw, but I'd rather use a screwdriver.
Regards,
-- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk