
31 Aug
2007
31 Aug
'07
6:54 a.m.
The following code: template<typename int_t> inline typename boost::enable_if_c<boost::is_integral<int_t>::value, std::complex<int_t> >::value operator >> (std::complex<int_t> const&x, int bits) { return std::complex<int_t> (real (x) >> bits, imag (x) >> bits); } // template<typename int_t> // inline std::complex<int_t> // operator >> (std::complex<int_t> const&x, int bits) { // return std::complex<int_t> (real (x) >> bits, imag (x) >> bits); // } int main() { std::cout << (x >> 1) << '\n'; } gives: error: no match for 'operator>>' in 'x >> 1' (gcc-4.1.2) Uncomment the commented out version (without enable_if) and it compiles. What's wrong here?