2012-04-06から1日間の記事一覧

decltype(x)::memberはGCC 4.7から

decltypeした型のメンバを使用する機能は、GCCでは4.7から使用できるようになったようです。備忘記。 #include <iostream> #include <map> #include <boost/range/algorithm/for_each.hpp> int main() { const std::map<std::string, int> m = { {"Alice", 16}, {"Bob", 32}, {"Carol", 23} }; boost::for_each(m, [](decltype(m)::</std::string,></boost/range/algorithm/for_each.hpp></map></iostream>…