
On Wed, Feb 27, 2013 at 5:13 PM, Steven Watanabe
Can you modify the attached program so that the object TCPositionTraits holds all the traits for the TCPosition object. Not just the traits for the "double" parameters, as is currently the case. Notably missing from TCPositionTraits is a reference to TCPosition::mSteps.
That's actually pretty easy:
typedef boost::variant< TSItemImpl<double>, TSItemImpl<unsigned> > TSItem;
then use boost::apply_visitor for all operations on TSItems.
Steven, Thank you for your help with this. I have reworked my code to use boost::variant and am happy with it(*): https://github.com/chrisstankevitz/trait (*) I am working right now to remove the hard-coded references to TCTraitsDouble and TCTraitsUnsigned within Traitses.h and instead make them user-definable via variadic template arguments. I have a question outstanding at comp.lang.c++.moderated which will hopefully give me some direction in that effort. Thank you again for your help and time diving in and understanding what I am attempting to do! Chris