Guillaume Paris
Guillaume Paris

Reputation: 10539

loop through a mpl::map

what is the simple way to loop through a mpl::map?

typedef mpl::string<'Curr'> key1;
typedef mpl::string<'Brid'> key2;
typedef mpl::map<pair<key1,int>, pair<key2,char> > m;

How can I loop through m ?

Upvotes: 2

Views: 597

Answers (1)

Kirill V. Lyadvinsky
Kirill V. Lyadvinsky

Reputation: 99555

Why don't you use mpl::for_each ? Something like:

mpl::for_each<
  m, 
  typename mpl::lambda< 
    mpl::key_type<
      m, 
      mpl::_1
    > 
  > 
>( do_some() ); 

Upvotes: 5

Related Questions