1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #ifndef BOOST_DEDUCED_060920_HPP
6 # define BOOST_DEDUCED_060920_HPP
8 # include <boost/mpl/for_each.hpp>
11 struct not_present_tag {};
12 not_present_tag not_present;
14 template <class E, class ArgPack>
15 struct assert_expected
17 assert_expected(E const& e, ArgPack const& args)
23 bool check_not_present(T const&) const
25 BOOST_MPL_ASSERT((boost::is_same<T,not_present_tag>));
30 bool check1(K const& k, not_present_tag const&, long) const
32 return check_not_present(args[k | not_present]);
35 template <class K, class Expected>
36 bool check1(K const& k, Expected const& expected, int) const
38 return test::equal(args[k], expected);
42 void operator()(K) const
44 boost::parameter::keyword<K> const& k = boost::parameter::keyword<K>::get();
45 assert(check1(k, expected[k], 0L));
52 template <class E, class ArgPack>
53 void check0(E const& e, ArgPack const& args)
55 boost::mpl::for_each<E>(assert_expected<E,ArgPack>(e, args));
58 template <class P, class E, class A0>
59 void check(E const& e, A0 const& a0)
64 template <class P, class E, class A0, class A1>
65 void check(E const& e, A0 const& a0, A1 const& a1)
67 check0(e, P()(a0,a1));
70 template <class P, class E, class A0, class A1, class A2>
71 void check(E const& e, A0 const& a0, A1 const& a1, A2 const& a2)
73 check0(e, P()(a0,a1,a2));
76 #endif // BOOST_DEDUCED_060920_HPP