Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
restrict_to, enable_if, etc
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Gennaro Prota, post: 3649170"] That's the info you should have given :-) About your original question, you *can* have one function parameter and enable_if on it (its type), but you'll usually face another issue: something like foo< ... >:: is a so-called "non-deduced context". A "classical" example is: template< typename T > struct identity { typedef T type ; } ; template< typename T > void f( typename identity< T >::type t ) { } int main() { f( 1 ) ; // can't deduce } So, even if you had simply struct Foo { template< typename T > void Func( typename enable_if_c< true, T >::type ) { } } ; it wouldn't work for your p (FWIW, f.Func< char * >( p ) would, instead). On the contrary, your second template gives a way to deduce an argument for T; and, after all arguments are deduced, they are substituted in non-deduced contexts (later, SFINAE applies). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
restrict_to, enable_if, etc
Top