21 #ifndef RFFGEN_UTIL_COMPUTE_PRODUCT_HH
22 #define RFFGEN_UTIL_COMPUTE_PRODUCT_HH
33 template <
class X,
class Y,
bool bothPresent>
34 struct ComputeProductImpl
36 static constexpr
bool present =
false;
37 ComputeProductImpl(X
const&, Y
const&) {}
40 template <
class X,
class Y>
41 struct ComputeProductImpl<X,Y,true>
43 static constexpr
bool present =
true;
45 ComputeProductImpl(X
const& x, Y
const& y) : value( x() * y() )
48 auto operator()()
const
53 decltype(std::declval<X>()() * std::declval<Y>()()) value;
56 template <class X, class Y>
57 struct ComputeProduct : public Detail::ComputeProductImpl<X,Y,X::present && Y::present>
59 ComputeProduct(X
const& x, Y
const& y)
60 : Detail::ComputeProductImpl<X,Y,X::present && Y::present> (x,y)
73 #endif // RFFGEN_UTIL_COMPUTE_PRODUCT_HH