I don't think BOOST_PP_SEQ_CONTAINS can be implemented. It would require you to be able to compare two sequences of preprocessing tokens, which you can't do.
However, if you rearrange your logic a bit, you can get something closer to what you want. First, we need a couple of helper macros for use with BOOST_PP_SEQ_FOR_EACH:
#include <boost/preprocessor.hpp>
// General purpose macros:
#define EXPAND_ENUM_CASE_2(text1, text2) text1 ## text2
#define EXPAND_ENUM_CASE(r, data, elem) \
case elem : EXPAND_ENUM_CASE_2(data ## _ ## CASE ## _ , elem)
We can define the list of enumerators and the enumeration just as you have in the original question:
#define WORKDAY_ENUMERATORS (Monday)(Tuesday)(Wednesday)(Thursday)
enum Workday { BOOST_PP_SEQ_ENUM(WORKDAY_ENUMERATORS) };
As you can see, I've left Friday off of the list because no one actually does work on Friday. Let's consider as an example a function that returns some text describing the day of the week.
Instead of testing whether an enumerator was included in the list, we define the cases for each of the values using macros:
#define WORKDAY_CASE_Monday { return "Mondays suck"; }
#define WORKDAY_CASE_Tuesday { return "Tuesdays are better than Mondays"; }
#define WORKDAY_CASE_Wednesday { return "Hooray for humpday!"; }
#define WORKDAY_CASE_Thursday { return "Thursdays are okay"; }
#define WORKDAY_CASE_Friday { return "No one really works on Friday"; }
We then generate the correct case statements for the list by using the WORKDAY_ENUMERATORS and concatenating the enumerators with the WORKDAY_CASE_ prefix:
const char* get_day_text(Workday d)
{
switch (d)
{
BOOST_PP_SEQ_FOR_EACH(EXPAND_ENUM_CASE, WORKDAY, WORKDAY_ENUMERATORS)
}
return "WTF?! That's not a workday!";
}
If a day was not included in the WORKDAY_ENUMERATORS list, no case will be generated for it.
Because we should be polite when we use the preprocessor, we then undefine the macros we used:
#undef WORKDAY_CASE_Monday
#undef WORKDAY_CASE_Tuesday
#undef WORKDAY_CASE_Wednesday
#undef WORKDAY_CASE_Thursday
#undef WORKDAY_CASE_Friday
I think this is kind of ugly, but it's one way to get almost the results you are seeking.