これをやりたいw


以下のをやりたいけど,できんw


#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <boost/bind.hpp>

struct test {
  void show(int x) const{
    std::cout << x << std::endl;
  }
};

int main(){

  std::map<int, test> m; // まぁこの例だとstd::mapの意味はないですがw

  m[0] = test();
  m[1] = test();
  m[2] = test();

  // これ(5はてきとう)
  std::for_each(m.begin(), m.end(), boost::bind(&(std::pair<int, test>::second_type::draw), _1, 5));


  typedef std::map<int, test>::const_iterator map_it_t;

  vector<map_it_t> v;

  for(map_it_t it = m.begin(); it != m.end(); ++it)
    v.push_back(it);

  // これも
  std::for_each(v.begin(), v.end(), boost::bind(&(std::vector<map_it_t>::iterator_type?::...::draw), _1, t));

  return 0;

}


うーん,分からない.


エラー読んでも意味が解らないし,ぐぐってもねぇ.


std::mapとかじゃできないのかなぁ.




とか思いながらもう一度ぐぐってみたら,なんか普通にそれっぽいのが出てきた.

あれー,ぐぐってなかったかも.

ぐぐりすぎて何をして何をしてないのか分からなくなってきたなw


select2nd<>がキーかも.


もうちょっとがんばってみます.