Dave, Another alternative would be to pass shared/base-ptr's and use double-dispatching to provide functions on concrete types. This however bothers the model-objects with visitation code; which is fine for 1 or 2 things but very disturbing on >10 functions. With the variant you can move the visitation logic completely to the client/caller code, Hopefully its not to vague...? Your option requires dynacasting and it doesn't allow the goodies such as enable-if on subsets of the variant types; which is al optimized at compiletime. I however agree that it's much simpler and in-fact we might had to explore this option more back then... ;) Thanks for thinking along. Paul Op 8-1-2011 21:53, Dave Abrahams schreef:
At Sat, 08 Jan 2011 02:17:36 -0500, Dave Abrahams wrote:
At Fri, 07 Jan 2011 23:45:04 +0100, Paul wrote:
In a project we are using variants holding shared_ptr's. These variants are typically 20 items large but are growing as the project progresses.
If it's really just shared_ptr's in the variant, I would seriously consider replacing it with shared_ptr<void> (with a type tag if necessary). Just a thought.
Seriously, could be a big simplification and speedup vs. using using variant.
not-going-to-mention-it-again-ly y'rs, Dave