detect an enum type in template arguments

Hi, consider the example below, is there a way to detect an enum type and non-enum type ? thus if there were a way to do it, assume it to be "is_enum<T>::value" then the output of example below would have been output: Generic Type Enumeration Type **************************** example begins *************************** // all types except enumeration come here template T> class Foo { void identify() { std::cout << "Generic"; } }; // all enumerations types come here <template T> class Foo<is_enum<T>::value> { void identify() { std::cout << "Enumeration"; } }; enum BarEnum { Mon, Tue, Wed }; int main( int argc, char* argv[]) { std::cout << Foo<int> << " Type" << std::endl; std::cout << Foo<BarEnum> << " Type" << std::endl; return 0; } **************************** example ends *************************** Aston

Aston-2 wrote:
Hi,
consider the example below, is there a way to detect an enum type and non-enum type ?
thus if there were a way to do it, assume it to be "is_enum::value" then the output of example below would have been
Hi, you should get what you are looking for with boost::enable_if. Best, Vicente -- View this message in context: http://boost.2283326.n4.nabble.com/detect-an-enum-type-in-template-arguments... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (3)
-
Aston
-
Juraj Ivančić
-
Vicente Botet