class_concept_check_test.cpp 954 B

12345678910111213141516171819202122232425262728293031323334
  1. // (C) Copyright Jeremy Siek 2000.
  2. // Distributed under the Boost Software License, Version 1.0. (See
  3. // accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. #include <boost/concept_check.hpp>
  6. /*
  7. This file verifies that the BOOST_CLASS_REQUIRE macro of the Boost
  8. Concept Checking Library does not cause errors when it is not suppose
  9. to.
  10. */
  11. struct foo { bool operator()(int) { return true; } };
  12. struct bar { bool operator()(int, char) { return true; } };
  13. class class_requires_test
  14. {
  15. BOOST_CONCEPT_ASSERT((boost::EqualityComparable<int>));
  16. typedef int* int_ptr; typedef const int* const_int_ptr;
  17. BOOST_CONCEPT_ASSERT((boost::EqualOp<int_ptr,const_int_ptr>));
  18. BOOST_CONCEPT_ASSERT((boost::UnaryFunction<foo,bool,int>));
  19. BOOST_CONCEPT_ASSERT((boost::BinaryFunction<bar,bool,int,char>));
  20. };
  21. int
  22. main()
  23. {
  24. class_requires_test x;
  25. boost::ignore_unused_variable_warning(x);
  26. return 0;
  27. }