I must be missing something obvious, or Boost.Mpl doesn't work on MSVC
7.1.
I'm working on my container class C<METRIC, PAYLOAD>. Using MPL
I've defined a class static bool IS_OUTER which, if true, means that
PAYLOADhas a typedef for the name "key_type". If IS_OUTER is
false, then PAYLOADmay not have such a typedef (and in my test case, it
doesn't). What I want to do, in C, is have a typedef that is
PAYLOAD::key_type if IS_OUTER is true and just plain PAYLOAD if IS_OUTER
is false. I cannot make it work. I've checked IS_OUTER and it has the
correct value. But no matter what combination of if_c, eval_if_c, apply,
etc. I use it won't compile because
"'key_type' : is not a member
of". Here's my basic example without the
elaboration:
typedef
typename
boost::mpl::if_c<IS_OUTER,
typename
PAYLOAD::key_type,
PAYLOAD
>::type
testing;
I've tried using eval_if_c with identity<> in the appropriate
places. I wrote a metafunction to get key_type and used apply<> on
that. In every case, however, the compiler evaluates PAYLOAD::key_type
and fails. Is this kind of thing possible using MPL? Is it possible using
MPL and MSVC 7.1? If so, can anyone give me a clue?
Thanks.