#pragma once #include "friendly_fusion.hpp" #include "index_list.hpp" #include #include #include template QVariant convert(boost::any const& x) { return QVariant::fromValue(boost::any_cast(x)); } template QVariant convert(boost::any const& x) { typedef friendly_fusion::result_of::begin begin; typedef friendly_fusion::result_of::advance_c adv_it; typedef friendly_fusion::result_of::deref deref; typedef typename std::decay::type value_type; return convert(x); } #if defined( __GNUC__ ) && !defined( __clang__ ) template std::function convert_lambda() { return [](boost::any const& any) { return convert(any); }; } #endif //defined( __GNUC__ ) && !defined( __clang__ ) template QVariant to_qvariant(boost::any const& any, int index, indices) { typedef std::function element_type; static element_type table[] = { #if defined( __GNUC__ ) && !defined( __clang__ ) //Workaround for gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47226 convert_lambda() ... #else [](boost::any const& any){return convert(any);} ... #endif //defined( __GNUC__ ) && !defined( __clang__ ) }; return table[index](any); } template QVariant to_qvariant(boost::any const& x, int index) { typedef typename friendly_fusion::result_of::size::type seq_size; typedef typename build_indices::type indices_type; return to_qvariant(x, index, indices_type{}); }