overloading.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2004 The Trustees of Indiana University.
  2. // Use, modification and distribution is subject to the Boost Software
  3. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt)
  5. // Authors: Douglas Gregor
  6. // Andrew Lumsdaine
  7. //
  8. // This file contains helps that enable concept-based overloading
  9. // within the Boost Graph Library.
  10. //
  11. #ifndef BOOST_GRAPH_OVERLOADING_HPP
  12. #define BOOST_GRAPH_OVERLOADING_HPP
  13. #include <boost/type_traits/is_base_and_derived.hpp>
  14. #include <boost/utility/enable_if.hpp>
  15. namespace boost { namespace graph { namespace detail {
  16. struct no_parameter {};
  17. } } } // end namespace boost::graph::detail
  18. #ifndef BOOST_NO_SFINAE
  19. #define BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, Type) \
  20. typename enable_if_c<(is_base_and_derived< \
  21. Tag, \
  22. typename graph_traits<Graph>::traversal_category>::value), \
  23. Type>::type
  24. #define BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, Tag) \
  25. , BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, \
  26. ::boost::graph::detail::no_parameter) \
  27. = ::boost::graph::detail::no_parameter()
  28. #else
  29. #define BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, Type) Type
  30. #define BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, Tag)
  31. #endif // no SFINAE support
  32. #endif // BOOST_GRAPH_OVERLOADING_HPP