
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tuesday 18 August 2009, topoden wrote:
Hello,
I'm trying to use boost::enable_if to customize function declaration for a particular set of template arguments. But instead of using SFINAE to remove incorrect declaration it produces error.
What you are doing is an error (and not just the extra void you have in the return types). SFINAE drops template functions from consideration during overload resolution. You would need to make the process member functions templates (but you can't because there are no virtual template methods in C++). It looks like what you are trying to do is provide a partial template specialization of BaseListener when the second template parameter is void.
template<class A, class B> struct BaseListener { typename boost::disable_if<boost::is_void< B >, void>::type void virtual process(A *, B *) = 0;
typename boost::enable_if<boost::is_void< B >, void>::type void virtual process(A *) = 0; }; -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux)
iEYEARECAAYFAkqK8jYACgkQ5vihyNWuA4X6EQCghDjl2cK4DNnny0rVa4Y0pANG pQYAniT1sOhdA2nDKbJysoGBDuIKzaU/ =2eVR -----END PGP SIGNATURE-----