
15 Dec
2006
15 Dec
'06
9:12 a.m.
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.