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

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -