C++0x インスタンスからメンバの型を取得する

identity + decltype でインスタンスからメンバの型を取得する

#include <map>
#include <string>

using namespace std;

int main()
{
    map<int, string> dict;

    // pair<int, string> value = ...
    identity<decltype(dict)>::type::value_type value = *dict.begin();

    value.first ...;
    value.second ...;

    return 0;
}

ちなみに std::identity は に入ります

namespace std {
    template <class T>
    struct identity {
        typedef T type;
    };
}