| 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 | |
| 11 | #include <boost/type_erasure/any.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/mpl/vector.hpp> |
| 16 | |
| 17 | #define BOOST_TEST_MAIN |
| 18 | #include <boost/test/unit_test.hpp> |
| 19 | |
| 20 | using namespace boost::type_erasure; |
| 21 | |
| 22 | template<class T = _self> |
| 23 | struct common : ::boost::mpl::vector< |
| 24 | copy_constructible<T>, |
| 25 | typeid_<T> |
| 26 | > {}; |
| 27 | |
| 28 | BOOST_AUTO_TEST_CASE(test_negate) |
| 29 | { |
| 30 | typedef ::boost::mpl::vector<common<>, negatable<> > test_concept; |
| 31 | any<test_concept> x(1); |
| 32 | any<test_concept> y(-x); |
| 33 | BOOST_CHECK_EQUAL(any_cast<int>(y), -1); |
| 34 | } |
| 35 |
