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. See the example below to see better
what I mean:
#include
#include
template
struct BaseListener
{
typename boost::disable_if, void>::type
void virtual process(A *, B *) = 0;
typename boost::enable_if, void>::type
void virtual process(A *) = 0;
};
struct Request
{
};
struct Response
{
};
typedef BaseListener BaseResponseListener;
typedef BaseListener BaseRequestListener;
struct RequestListener : public BaseRequestListener
{
void process(Request *, BaseResponseListener *)
{
}
};
struct ResponseListener : public BaseResponseListener
{
void process(Request *)
{
}
};
int main(int argc, char * argv[])
{
RequestListener reqListener;
ResponseListener resListener;
return 0;
}
error message:
error C2039: 'type' : is not a member of 'boost::enable_if'
1> with
1> [
1> Cond=boost::is_void<BaseResponseListener>,
1> T=void
1> ]
1> c:\!projects\temp\consoleeventhandler\consoleeventhandler.cpp(134)
: see reference to class template instantiation 'BaseListener' being
compiled
1> with
1> [
1> A=Request,
1> B=BaseResponseListener
1> ]
--
View this message in context: http://www.nabble.com/boost%3A%3Aenable_if%2C-did-I-get-it-wrong---tp2502791...
Sent from the Boost - Users mailing list archive at Nabble.com.