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