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