1 // Copyright 2008-2010 Gordon Woodhull
2 // Distributed under the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef BOOST_MSM_MPL_GRAPH_MPL_UTILS_HPP_INCLUDED
6 #define BOOST_MSM_MPL_GRAPH_MPL_UTILS_HPP_INCLUDED
8 #include <boost/mpl/fold.hpp>
9 #include <boost/mpl/map.hpp>
10 #include <boost/mpl/set.hpp>
11 #include <boost/mpl/insert.hpp>
12 #include <boost/mpl/if.hpp>
13 #include <boost/mpl/has_key.hpp>
14 #include <boost/mpl/at.hpp>
15 #include <boost/mpl/and.hpp>
22 // This is a grab bag of little metafunctions I expect already
23 // exist under some name I haven't looked for
25 // I figure there are probably better ways to do all of these things,
26 // but for now I'll just write some utilities to isolate my ignorance
28 template<typename Seq>
32 mpl::insert<mpl::_1, mpl::_2> >
34 template<typename Seq>
38 mpl::insert<mpl::_1, mpl::_2> >
41 template<typename AssocSeq, typename Key, typename Default>
42 struct at_or_default :
43 mpl::if_<typename mpl::has_key<AssocSeq, Key>::type,
44 typename mpl::at<AssocSeq, Key>::type,
48 template<typename Seq1, typename Seq2>
53 mpl::has_key<typename as_set<Seq1>::type,
62 #endif // BOOST_MSM_MPL_GRAPH_MPL_UTILS_HPP_INCLUDED