c++ - decltype and static template method -


in attempt use sfinae, following code fails compile:

template<typename objecttype, typename groupa, typename groupb, typename = void> struct delegateimpl; // default version  template<typename objecttype, typename groupa, typename groupb> struct delegateimpl<objecttype, groupa, groupb, decltype(groupa::get<objecttype>())>; // specialization 

with gcc:

error: template argument 4 invalid

with msvc, surprisingly more helpful:

error c3553: decltype expects expression not type

my aim have compiler pick specialization if expression groupa::get<objecttype>() valid.

question: how use decltype static template method?

neither compilers give helpful errors actually. real issue you're missing template keyword before get:

template get<objecttype>() 

see cppreference's page on dependent names


Comments

Popular posts from this blog

wireshark - USB mapping with python -

c++ - nodejs socket.io closes connection before upgrading to websocket -

Deploying Qt Application on Android is really slow? -