1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
struct dot_product_
{
template<class Sig> struct result;
template<class This,class T1,class T2>
struct result< This( std::vector<T1>,std::vector<T2>) >
{
static T1& t1;
static T2& t2;
typedef typename BOOST_TYPEOF_TPL( t1*t2 ) type;
};
template<class T1,class T2> inline
typename result<dot_product(T1,T2)>::type
operator()( T1 const& a, T2 const& b) const
{
return ...;
}
};
template<class T1,class T2> inline
typename boost::result_of<dot_product_(T1,T2)>::type
dot_product( T1 const& a, T2 const& b)
{
dot_product_ callee;
return callee(a,b);
} |