[variant].[apply_visitor] Binary visitation: Build related problem.

Hi, Compiler instantiates the second Binary visitor instead of the first one even though the template parameters are same. regards, Prashant --------------------------------------------------------------------------- struct add_tuple_visitor: public boost::static_visitor<bool> { // Expected this to be instantiated by the compiler. // 1. template <typename T> bool operator()( T & lhs, const T & rhs) const { lhs += rhs ; return true; } // Compiler considers this as an appropriate fit .. // 2. template <typename T, typename U> bool operator()( T & lhs, const U & rhs) const { lhs += rhs ; return true; } }; struct agg_calc { public: template <typename T> bool operator () ( T & lhs, const T & rhs ) const { for( std::size_t curr_oper = 0; curr_oper < num_operations; ++v ) { switch( agg_operators.at(curr_oper) ) { case '+' : boost::apply_visitor( agg_visitor, lhs.at(curr_oper), //vector of variants rhs.at(curr_oper) //vector of variants ); break; default: break; }; } // for loop return true; } //Store the aggregation operators agg_types agg_operators; std::size_t num_operations; // Create visitor objects for delayed form of apply_visitor add_tuple_visitor agg_visitor; }; ---------------------------------------------------------------------------
participants (1)
-
Prashant Thakre