On Tue, May 12, 2015 at 8:19 AM, Boris Rasin
There is already well established customization point for this:
#include <utility>
try { using std::get; auto val = get<T>(value); catch(...) { // handle exception }
This already works for std::tuple, std::pair and boost::variant. One could also add implementation for boost::any:
#include
namespace boost { template<typename T> inline T get(const any& a) { return any_cast<T>(a); } }
Hey guys, thanks for the awesome feedback. I have to admit, I don't quite see how the class has access to the user defined overloads of get<T> if it hasn't explicitly been included in the class, but I tested it (defined get<T>(boost::any& a) in my main.cpp file) and it works beautifully. Most of the features I can think of are in now complete, I think the next step would be to use it and test it out and get any feedback including additional features to be included. The source can be gotten at https://github.com/armstrhu/poly_adaptor for anyone interested. Thanks again. -- James Armstrong