Boost logo

Boost :

From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2003-09-10 08:07:38


This should have been posted to the Users list, but seems like
it is temporarily disabled.

Say I've got a MPL sequence whose elements
contain a nested typedef "type_list" which is also a MPL sequence
(so, a sequence of sequences). This algorithm looks for an element
of such a sequence having a given type in its "type_list" typedef:

template<typename TypeListofTypeLists,typename Type>
struct find_type
{
  typedef typename mpl::find_if<
    TypeListofTypeLists,
    mpl::bind1<has_type<Tag>,mpl::_1>
>::type iter;

  typedef typename iter::type type;
};

template<typename Type>
struct has_type
{
  template<typename TypeListofTypeListsElement>
  struct apply:mpl::contains<
    BOOST_DEDUCED_TYPENAME TypeListofTypeListsElement::type_list,
    Type>
  {};
};

This works but seems to make MSVC++ 6.0 choke under moderate
stress. Any idea to simplify it? (unrolling, etc.) Thanx in advance

Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk