2 //=======================================================================
3 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
4 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
6 // Distributed under the Boost Software License, Version 1.0. (See
7 // accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
9 //=======================================================================
12 #ifndef BOOST_INDIRECT_CMP_HPP
13 #define BOOST_INDIRECT_CMP_HPP
16 #include <boost/config.hpp>
17 #include <boost/property_map.hpp>
23 // could also do this with compose_f_gx_hx, and the member binder...
27 //!tparam: ReadablePropertyMap - a model of ReadablePropertyMap
28 //!definition: functor.h
29 template <class ReadablePropertyMap, class Compare>
32 typedef typename boost::property_traits<ReadablePropertyMap>::value_type T;
33 typedef typename boost::property_traits<ReadablePropertyMap>::key_type K;
34 typedef K first_argument_type;
35 typedef K second_argument_type;
36 typedef T result_type;
37 inline indirect_cmp(const ReadablePropertyMap& df, const Compare& c = Compare())
40 template <class A, class B>
42 operator()(const A& u, const B& v) const {
43 T du = get(d, u), dv = get(d, v);
47 ReadablePropertyMap d;
51 template <typename Compare, typename ReadablePropertyMap>
52 indirect_cmp<ReadablePropertyMap, Compare>
53 make_indirect_cmp(const Compare& cmp, ReadablePropertyMap pmap) {
54 indirect_cmp<ReadablePropertyMap, Compare> p(pmap, cmp);
58 template <class ReadablePropertyMap>
61 typedef typename boost::property_traits<ReadablePropertyMap>::value_type T;
62 typedef typename boost::property_traits<ReadablePropertyMap>::key_type K;
63 typedef K argument_type;
64 typedef T result_type;
65 inline indirect_pmap(const ReadablePropertyMap& df)
68 inline bool operator()(const K& u) const {
72 ReadablePropertyMap d;
75 template <typename ReadablePropertyMap>
76 indirect_pmap<ReadablePropertyMap>
77 make_indirect_pmap(ReadablePropertyMap pmap) {
78 indirect_pmap<ReadablePropertyMap> f(pmap);
86 #endif // GGCL_INDIRECT_CMP_HPP