Boost Variant Type Interfaces
Hi, In our project we are using boost, boost.variant very extensively. We was using methods provided by the library to interface with Variant types. Mainly : get<T>( variant ) for accessing stored values and variant.which() == Index for checking currently stored type. Overtime we realized we can improve this as : variant.getT() for accessing stored values much more nicer to write and variant.isT() or variant.which() == WHICH_T for checking currently stored type which does not depend on order of template paramters in the Variant definition. Also in some cases we wanted to be able to add type specific methods for example in our case we are using subscript operator to access recursively stored Variants variant[ "a" ].isT() or variant[ 0 ].asT() We generalized this solution for our project and published at https://github.com/FictionIO/WrappedVariant I would like to hear your comments. Do you think its a correct approach or useful? Any suggestions are welcome! Kind Regards, Ali
participants (1)
-
Ali Nakipoglu