find
(result_of::endが返ってきたら該当なし)
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm/query/find.hpp> #include <boost/type_traits.hpp> #include <boost/static_assert.hpp> using namespace boost; using namespace boost::fusion; int main() { typedef vector<int, char, double> seq; typedef result_of::find<seq, char>::type result; BOOST_STATIC_ASSERT((!is_same<result, result_of::end<seq>::type>::value)); }
filter
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm/transformation/filter.hpp> #include <boost/type_traits.hpp> #include <boost/static_assert.hpp> using namespace boost; using namespace boost::fusion; int main() { typedef vector<int, char, double, int> seq; typedef result_of::filter<seq, int>::type result; BOOST_STATIC_ASSERT((is_same<result_of::as_vector<result>::type, vector<int, int> >::value)); }
filter_if
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm/transformation/filter_if.hpp> #include <boost/type_traits.hpp> #include <boost/static_assert.hpp> using namespace boost; using namespace boost::fusion; int main() { typedef vector<int, char, double, int> seq; typedef result_of::filter_if<seq, is_same<mpl::_, int> >::type result; BOOST_STATIC_ASSERT((is_same<result_of::as_vector<result>::type, vector<int, int> >::value)); }
reverse
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm/transformation/reverse.hpp> #include <boost/type_traits.hpp> #include <boost/static_assert.hpp> using namespace boost; using namespace boost::fusion; int main() { typedef vector<int, char, double> seq; typedef result_of::reverse<seq>::type result; BOOST_STATIC_ASSERT((is_same<result_of::as_vector<result>::type, vector<double, char, int> >::value)); }
zip
#include <boost/fusion/container/vector.hpp> #include <boost/fusion/algorithm/transformation/zip.hpp> #include <boost/type_traits.hpp> #include <boost/static_assert.hpp> using namespace boost; using namespace boost::fusion; int main() { typedef vector<int, char> seq1; typedef vector<double, long> seq2; typedef fusion::result_of::zip<seq1, seq2>::type result; BOOST_STATIC_ASSERT((is_same<fusion::result_of::as_vector<result>::type, vector<vector<int, double>, vector<char, long> > >::value)); }