old_concept_pass.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. // (C) Copyright Jeremy Siek, David Abrahams 2000-2006.
  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. #include "old_concepts.hpp"
  7. // This test verifies that use of the old-style concept checking
  8. // classes still compiles (but not that it detects constraint
  9. // violations). We check them with the old-style macros just for
  10. // completeness, since those macros stranslate into
  11. // BOOST_CONCEPT_ASSERTs.
  12. struct foo { bool operator()(int) { return true; } };
  13. struct bar { bool operator()(int, char) { return true; } };
  14. class class_requires_test
  15. {
  16. BOOST_CLASS_REQUIRE(int, old, EqualityComparableConcept);
  17. typedef int* int_ptr; typedef const int* const_int_ptr;
  18. BOOST_CLASS_REQUIRE2(int_ptr, const_int_ptr, old, EqualOpConcept);
  19. BOOST_CLASS_REQUIRE3(foo, bool, int, old, UnaryFunctionConcept);
  20. BOOST_CLASS_REQUIRE4(bar, bool, int, char, old, BinaryFunctionConcept);
  21. };
  22. int
  23. main()
  24. {
  25. class_requires_test x;
  26. boost::ignore_unused_variable_warning(x);
  27. return 0;
  28. }