test_binding_of.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // Boost.TypeErasure library
  2. //
  3. // Copyright 2011 Steven Watanabe
  4. //
  5. // Distributed under the Boost Software License Version 1.0. (See
  6. // accompanying file LICENSE_1_0.txt or copy at
  7. // http://www.boost.org/LICENSE_1_0.txt)
  8. //
  9. // $Id$
  10. #include <boost/type_erasure/any.hpp>
  11. #include <boost/type_erasure/tuple.hpp>
  12. #include <boost/type_erasure/builtin.hpp>
  13. #include <boost/type_erasure/operators.hpp>
  14. #include <boost/type_erasure/any_cast.hpp>
  15. #include <boost/type_erasure/binding_of.hpp>
  16. #include <boost/mpl/vector.hpp>
  17. #define BOOST_TEST_MAIN
  18. #include <boost/test/unit_test.hpp>
  19. using namespace boost::type_erasure;
  20. template<class T = _self>
  21. struct common : ::boost::mpl::vector<
  22. copy_constructible<T>,
  23. typeid_<T>
  24. > {};
  25. BOOST_AUTO_TEST_CASE(test_binding_of)
  26. {
  27. typedef ::boost::mpl::vector<common<> > test_concept;
  28. any<test_concept> x(2);
  29. binding<test_concept> b = binding_of(x);
  30. binding<test_concept> expected(
  31. make_binding<
  32. ::boost::mpl::map< ::boost::mpl::pair<_self, int> >
  33. >());
  34. BOOST_CHECK(b == expected);
  35. }