Martin Pasdzierny writes:
Stepping forward in dealing with a mpl::vector_c of enums I found it hard to determine the correct expression to 'mpl::find' an element within such a vector. The code below compiles with gcc 3.3.3 and shows 5 different approaches, but only version 4,5 really find the correct iterator. Version 1,2,3 return iterators pointing to the vectors end. It would be helpful if someone more familiar with MPL's concepts could give some explanation, particularly about the aspects:
- Is there a solution using mpl::find instead of mpl::find_if
Yes (assuming that the sequence you are searching in satisfies
Integral Sequence Wrapper requirements):
typedef vector_c
If not, why the difference between finding elements in mpl::vector and mpl::vector_c ?
'find' uses *type equality* ('boost::is_same') to determine whether
the elements are the same, and from standpoint of the C++ compiler,
all these
integral_c
- What is the difference between using integral wrappers: boost::mpl::integral_c
> boost::mpl::int_<c>
See the above.
- And still the question from the previous posting: Can I (should I) tell mpl::vector_c I'm using my own enum type and not plain int ?
Not at the moment, see my earlier reply. HTH, -- Aleksey Gurtovoy MetaCommunications Engineering