overloading.hpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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
  16. {
  17. namespace graph
  18. {
  19. namespace detail
  20. {
  21. struct no_parameter
  22. {
  23. };
  24. }
  25. }
  26. } // end namespace boost::graph::detail
  27. #ifndef BOOST_NO_SFINAE
  28. #define BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, Type) \
  29. typename enable_if_c< \
  30. (is_base_and_derived< Tag, \
  31. typename graph_traits< Graph >::traversal_category >::value), \
  32. Type >::type
  33. #define BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, Tag) \
  34. , \
  35. BOOST_GRAPH_ENABLE_IF_MODELS( \
  36. Graph, Tag, ::boost::graph::detail::no_parameter) \
  37. = ::boost::graph::detail::no_parameter()
  38. #else
  39. #define BOOST_GRAPH_ENABLE_IF_MODELS(Graph, Tag, Type) Type
  40. #define BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, Tag)
  41. #endif // no SFINAE support
  42. #endif // BOOST_GRAPH_OVERLOADING_HPP