compose.cpp 1016 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/builtin.hpp>
  11. #include <boost/type_erasure/operators.hpp>
  12. #include <boost/mpl/vector.hpp>
  13. namespace mpl = boost::mpl;
  14. using namespace boost::type_erasure;
  15. //[compose1
  16. /*`
  17. Multiple concepts can be composed using an MPL sequence.
  18. */
  19. template<class T = _self>
  20. struct arithmetic :
  21. mpl::vector<
  22. copy_constructible<T>,
  23. addable<T>,
  24. subtractable<T>,
  25. multipliable<T>,
  26. dividable<T>,
  27. equality_comparable<T>,
  28. less_than_comparable<T>
  29. >
  30. {};
  31. /*`
  32. Now, `arithmetic` is a concept that can be used just
  33. like any of the base concepts.
  34. */
  35. //]
  36. //[compose
  37. //` (For the source of the examples in this section see
  38. //` [@boost:/libs/type_erasure/example/compose.cpp compose.cpp])
  39. //` [compose1]
  40. //]