|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2006-12-15 04:12:35
Joel de Guzman wrote:
>>> I suppose I could have used a vector instead, but it's less elegant
>>> somehow.
>>
>> How the std::vector<boost::variant> is less elegant?
>>
>> 1. It's could be implemented in cpp file. Your tuple based solution
>> is in header right?
>> 2. It allows dynamically sized entries, so you could skip some of the
>> default values
>> 3. It's as fast of could be even faster since we don't need to pass
>> big structures around
No std::vector does a deep copy (read memory allocation) with every copy.
That means vector based code would be several orders of magnitude slower
than passing small-ish tuples up and down the stack.
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk