[prev in list] [next in list] [prev in thread] [next in thread]
List: boost-users
Subject: [Boost-users] =?utf-8?b?W3ZhcmlhbnRdLlthcHBseV92aXNpdG9yXSBCaW5h?=
From: Prashant Thakre <prashant.thakre () gmail ! com>
Date: 2006-07-10 10:25:57
Message-ID: loom.20060710T115047-875 () post ! gmane ! org
[Download RAW message or body]
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;
};
---------------------------------------------------------------------------
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic