Skip to main content
added 338 characters in body
Source Link
Jahid
  • 22.6k
  • 10
  • 97
  • 114

template should be declared like this in David Rodríguez's method (for functions with return type):

template <class<template T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > T func(T x){} 

For multiple condition:

template <class<template T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > T func(T x){} 

For functions without return type:

template <class<template T> typename std::enable_if<!std::is_same<T,std::string>::value>::type func(T x){} 

For multiple condition:

template <class<template T> typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type func(T x){} 

Don't forget to include #include <type_traits>

template should be declared like this in David Rodríguez's method (for functions with return type):

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > T func(T x){} 

For multiple condition:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > T func(T x){} 

For functions without return type:

template <class T> typename std::enable_if<!std::is_same<T,std::string>::value>::type func(T x){} 

For multiple condition:

template <class T> typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type func(T x){} 

template should be declared like this in David Rodríguez's method (for functions with return type):

template <template T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > T func(T x){} 

For multiple condition:

template <template T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > T func(T x){} 

For functions without return type:

template <template T> typename std::enable_if<!std::is_same<T,std::string>::value>::type func(T x){} 

For multiple condition:

template <template T> typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type func(T x){} 

Don't forget to include #include <type_traits>

added 338 characters in body
Source Link
Jahid
  • 22.6k
  • 10
  • 97
  • 114

template should be declared like this in David Rodríguez's method (for functions with return type):

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > T func(T x){} 

For multiple condition:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > T func(T x){} 

The next code segment will exclude both string and intFor functions without return type:

template <class T> typename std::enable_if<!std::is_same<T,std::string>::value>::type func(T x){} 

For multiple condition:

template <class T> typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type func(T x){} 

template should be declared like this in David Rodríguez's method:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > 

For multiple condition:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > 

The next code segment will exclude both string and int

template should be declared like this in David Rodríguez's method (for functions with return type):

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > T func(T x){} 

For multiple condition:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > T func(T x){} 

For functions without return type:

template <class T> typename std::enable_if<!std::is_same<T,std::string>::value>::type func(T x){} 

For multiple condition:

template <class T> typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type func(T x){} 
Source Link
Jahid
  • 22.6k
  • 10
  • 97
  • 114

template should be declared like this in David Rodríguez's method:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value>::type* = nullptr > 

For multiple condition:

template <class T, typename std::enable_if<!std::is_same<T,std::string>::value &&!std::is_same<T,int>::value>::type* = nullptr > 

The next code segment will exclude both string and int