Subject: [boost] [mpl] set_c with enums
From: Domagoj Saric (domagoj.saric_at_[hidden])
Date: 2009-10-01 09:13:40


void aFunction()
{
  enum AnEnum
  {
      First,
      Second,
      Third,
      Fourth
  };

  typedef boost::mpl::set_c<AnEnum, First, Fourth, Third> AnEnumSubSet;

  bool const exists
  (
      boost::mpl::has_key
     <
        AnEnumSubSet,
        boost::mpl::integral_c<AnEnum, Second>
>::value
  );
}

the above code fails to compile in MSVC++ 9.0 SP1 and 10.0b1 with the
following error(s):
error C2440: 'specialization' : cannot convert from 'int' to
'aFunction::AnEnum'

if the AnEnumSubSet definition is changed to use ...set_c<int... everything
compiles and works properly (the has_key statement can still use the
enum)...everything also works properly (with an enum) when using vector_c
and contains instead of set_c and has_key...

--
 "That men do not learn very much from the lessons of history is the most
important of all the lessons of history."
 Aldous Huxley