2010-08-29から1日間の記事一覧

boost::tuple で for_each のような処理

for_each のように各値に対して捜査するような処理が欲しかったので書いてみた。 #include <assert.h> #include <boost/tuple/tuple.hpp> namespace detail{ template<int N> struct int2type{ static const int value = N; }; using boost::tuples::length; template<typename tuple_t, typename F, int index> void tuple_for_each_impl(tuple</typename></int></boost/tuple/tuple.hpp></assert.h>…