has_constraints.hpp 989 B

1234567891011121314151617181920212223242526272829303132
  1. // Copyright David Abrahams 2006. Distributed under the Boost
  2. // Software License, Version 1.0. (See accompanying
  3. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP
  5. # define BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP
  6. namespace boost { namespace concept_checking {
  7. // Here we implement the "metafunction" that detects whether a
  8. // constraints metafunction exists
  9. typedef char yes;
  10. typedef char (&no)[2];
  11. template <class Model, void (Model::*)()>
  12. struct wrap_constraints {};
  13. template <class Model>
  14. inline yes has_constraints_(Model*, wrap_constraints<Model,&Model::constraints>* = 0);
  15. inline no has_constraints_(...);
  16. template <class Model>
  17. struct has_constraints
  18. {
  19. BOOST_STATIC_CONSTANT(
  20. bool
  21. , value = sizeof( concept_checking::has_constraints_((Model*)0) ) == 1 );
  22. };
  23. }} // namespace boost::concept_checking
  24. #endif // BOOST_CONCEPT_CHECK_HAS_CONSTRAINTS_DWA2006429_HPP