annotate DEPENDENCIES/generic/include/boost/graph/named_function_params.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 //=======================================================================
Chris@16 2 // Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
Chris@16 3 // Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
Chris@16 4 //
Chris@16 5 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 6 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 7 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 8 //=======================================================================
Chris@16 9
Chris@16 10 #ifndef BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP
Chris@16 11 #define BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP
Chris@16 12
Chris@16 13 #include <functional>
Chris@16 14 #include <vector>
Chris@16 15 #include <boost/limits.hpp>
Chris@16 16 #include <boost/ref.hpp>
Chris@16 17 #include <boost/utility/result_of.hpp>
Chris@16 18 #include <boost/preprocessor.hpp>
Chris@16 19 #include <boost/parameter/name.hpp>
Chris@16 20 #include <boost/parameter/binding.hpp>
Chris@16 21 #include <boost/type_traits.hpp>
Chris@16 22 #include <boost/mpl/not.hpp>
Chris@16 23 #include <boost/graph/properties.hpp>
Chris@16 24 #include <boost/graph/detail/d_ary_heap.hpp>
Chris@16 25 #include <boost/property_map/property_map.hpp>
Chris@16 26 #include <boost/property_map/shared_array_property_map.hpp>
Chris@16 27
Chris@16 28 namespace boost {
Chris@16 29
Chris@16 30 struct parity_map_t { };
Chris@16 31 struct vertex_assignment_map_t { };
Chris@16 32 struct distance_compare_t { };
Chris@16 33 struct distance_combine_t { };
Chris@16 34 struct distance_inf_t { };
Chris@16 35 struct distance_zero_t { };
Chris@16 36 struct buffer_param_t { };
Chris@16 37 struct edge_copy_t { };
Chris@16 38 struct vertex_copy_t { };
Chris@16 39 struct vertex_isomorphism_t { };
Chris@16 40 struct vertex_invariant_t { };
Chris@16 41 struct vertex_invariant1_t { };
Chris@16 42 struct vertex_invariant2_t { };
Chris@16 43 struct edge_compare_t { };
Chris@16 44 struct vertex_max_invariant_t { };
Chris@16 45 struct orig_to_copy_t { };
Chris@16 46 struct root_vertex_t { };
Chris@16 47 struct polling_t { };
Chris@16 48 struct lookahead_t { };
Chris@16 49 struct in_parallel_t { };
Chris@16 50 struct attractive_force_t { };
Chris@16 51 struct repulsive_force_t { };
Chris@16 52 struct force_pairs_t { };
Chris@16 53 struct cooling_t { };
Chris@16 54 struct vertex_displacement_t { };
Chris@16 55 struct iterations_t { };
Chris@16 56 struct diameter_range_t { };
Chris@16 57 struct learning_constant_range_t { };
Chris@16 58 struct vertices_equivalent_t { };
Chris@16 59 struct edges_equivalent_t { };
Chris@16 60 struct index_in_heap_map_t { };
Chris@16 61 struct max_priority_queue_t { };
Chris@16 62
Chris@16 63 #define BOOST_BGL_DECLARE_NAMED_PARAMS \
Chris@16 64 BOOST_BGL_ONE_PARAM_CREF(weight_map, edge_weight) \
Chris@16 65 BOOST_BGL_ONE_PARAM_CREF(weight_map2, edge_weight2) \
Chris@16 66 BOOST_BGL_ONE_PARAM_CREF(distance_map, vertex_distance) \
Chris@16 67 BOOST_BGL_ONE_PARAM_CREF(distance_map2, vertex_distance2) \
Chris@16 68 BOOST_BGL_ONE_PARAM_CREF(predecessor_map, vertex_predecessor) \
Chris@16 69 BOOST_BGL_ONE_PARAM_CREF(rank_map, vertex_rank) \
Chris@16 70 BOOST_BGL_ONE_PARAM_CREF(root_map, vertex_root) \
Chris@16 71 BOOST_BGL_ONE_PARAM_CREF(root_vertex, root_vertex) \
Chris@16 72 BOOST_BGL_ONE_PARAM_CREF(edge_centrality_map, edge_centrality) \
Chris@16 73 BOOST_BGL_ONE_PARAM_CREF(centrality_map, vertex_centrality) \
Chris@16 74 BOOST_BGL_ONE_PARAM_CREF(parity_map, parity_map) \
Chris@16 75 BOOST_BGL_ONE_PARAM_CREF(color_map, vertex_color) \
Chris@16 76 BOOST_BGL_ONE_PARAM_CREF(edge_color_map, edge_color) \
Chris@16 77 BOOST_BGL_ONE_PARAM_CREF(capacity_map, edge_capacity) \
Chris@16 78 BOOST_BGL_ONE_PARAM_CREF(residual_capacity_map, edge_residual_capacity) \
Chris@16 79 BOOST_BGL_ONE_PARAM_CREF(reverse_edge_map, edge_reverse) \
Chris@16 80 BOOST_BGL_ONE_PARAM_CREF(discover_time_map, vertex_discover_time) \
Chris@16 81 BOOST_BGL_ONE_PARAM_CREF(lowpoint_map, vertex_lowpoint) \
Chris@16 82 BOOST_BGL_ONE_PARAM_CREF(vertex_index_map, vertex_index) \
Chris@16 83 BOOST_BGL_ONE_PARAM_CREF(vertex_index1_map, vertex_index1) \
Chris@16 84 BOOST_BGL_ONE_PARAM_CREF(vertex_index2_map, vertex_index2) \
Chris@16 85 BOOST_BGL_ONE_PARAM_CREF(vertex_assignment_map, vertex_assignment_map) \
Chris@16 86 BOOST_BGL_ONE_PARAM_CREF(visitor, graph_visitor) \
Chris@16 87 BOOST_BGL_ONE_PARAM_CREF(distance_compare, distance_compare) \
Chris@16 88 BOOST_BGL_ONE_PARAM_CREF(distance_combine, distance_combine) \
Chris@16 89 BOOST_BGL_ONE_PARAM_CREF(distance_inf, distance_inf) \
Chris@16 90 BOOST_BGL_ONE_PARAM_CREF(distance_zero, distance_zero) \
Chris@16 91 BOOST_BGL_ONE_PARAM_CREF(edge_copy, edge_copy) \
Chris@16 92 BOOST_BGL_ONE_PARAM_CREF(vertex_copy, vertex_copy) \
Chris@16 93 BOOST_BGL_ONE_PARAM_REF(buffer, buffer_param) \
Chris@16 94 BOOST_BGL_ONE_PARAM_CREF(orig_to_copy, orig_to_copy) \
Chris@16 95 BOOST_BGL_ONE_PARAM_CREF(isomorphism_map, vertex_isomorphism) \
Chris@16 96 BOOST_BGL_ONE_PARAM_CREF(vertex_invariant, vertex_invariant) \
Chris@16 97 BOOST_BGL_ONE_PARAM_CREF(vertex_invariant1, vertex_invariant1) \
Chris@16 98 BOOST_BGL_ONE_PARAM_CREF(vertex_invariant2, vertex_invariant2) \
Chris@16 99 BOOST_BGL_ONE_PARAM_CREF(vertex_max_invariant, vertex_max_invariant) \
Chris@16 100 BOOST_BGL_ONE_PARAM_CREF(polling, polling) \
Chris@16 101 BOOST_BGL_ONE_PARAM_CREF(lookahead, lookahead) \
Chris@16 102 BOOST_BGL_ONE_PARAM_CREF(in_parallel, in_parallel) \
Chris@16 103 BOOST_BGL_ONE_PARAM_CREF(displacement_map, vertex_displacement) \
Chris@16 104 BOOST_BGL_ONE_PARAM_CREF(attractive_force, attractive_force) \
Chris@16 105 BOOST_BGL_ONE_PARAM_CREF(repulsive_force, repulsive_force) \
Chris@16 106 BOOST_BGL_ONE_PARAM_CREF(force_pairs, force_pairs) \
Chris@16 107 BOOST_BGL_ONE_PARAM_CREF(cooling, cooling) \
Chris@16 108 BOOST_BGL_ONE_PARAM_CREF(iterations, iterations) \
Chris@16 109 BOOST_BGL_ONE_PARAM_CREF(diameter_range, diameter_range) \
Chris@16 110 BOOST_BGL_ONE_PARAM_CREF(learning_constant_range, learning_constant_range) \
Chris@16 111 BOOST_BGL_ONE_PARAM_CREF(vertices_equivalent, vertices_equivalent) \
Chris@16 112 BOOST_BGL_ONE_PARAM_CREF(edges_equivalent, edges_equivalent) \
Chris@16 113 BOOST_BGL_ONE_PARAM_CREF(index_in_heap_map, index_in_heap_map) \
Chris@16 114 BOOST_BGL_ONE_PARAM_REF(max_priority_queue, max_priority_queue)
Chris@16 115
Chris@16 116 template <typename T, typename Tag, typename Base = no_property>
Chris@16 117 struct bgl_named_params
Chris@16 118 {
Chris@16 119 typedef bgl_named_params self;
Chris@16 120 typedef Base next_type;
Chris@16 121 typedef Tag tag_type;
Chris@16 122 typedef T value_type;
Chris@16 123 bgl_named_params(T v = T()) : m_value(v) { }
Chris@16 124 bgl_named_params(T v, const Base& b) : m_value(v), m_base(b) { }
Chris@16 125 T m_value;
Chris@16 126 Base m_base;
Chris@16 127
Chris@16 128 #define BOOST_BGL_ONE_PARAM_REF(name, key) \
Chris@16 129 template <typename PType> \
Chris@16 130 bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t), self> \
Chris@16 131 name(PType& p) const { \
Chris@16 132 typedef bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t), self> Params; \
Chris@16 133 return Params(boost::ref(p), *this); \
Chris@16 134 } \
Chris@16 135
Chris@16 136 #define BOOST_BGL_ONE_PARAM_CREF(name, key) \
Chris@16 137 template <typename PType> \
Chris@16 138 bgl_named_params<PType, BOOST_PP_CAT(key, _t), self> \
Chris@16 139 name(const PType& p) const { \
Chris@16 140 typedef bgl_named_params<PType, BOOST_PP_CAT(key, _t), self> Params; \
Chris@16 141 return Params(p, *this); \
Chris@16 142 } \
Chris@16 143
Chris@16 144 BOOST_BGL_DECLARE_NAMED_PARAMS
Chris@16 145
Chris@16 146 #undef BOOST_BGL_ONE_PARAM_REF
Chris@16 147 #undef BOOST_BGL_ONE_PARAM_CREF
Chris@16 148
Chris@16 149 // Duplicate
Chris@16 150 template <typename PType>
Chris@16 151 bgl_named_params<PType, vertex_color_t, self>
Chris@16 152 vertex_color_map(const PType& p) const {return this->color_map(p);}
Chris@16 153 };
Chris@16 154
Chris@16 155 #define BOOST_BGL_ONE_PARAM_REF(name, key) \
Chris@16 156 template <typename PType> \
Chris@16 157 bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t)> \
Chris@16 158 name(PType& p) { \
Chris@16 159 typedef bgl_named_params<boost::reference_wrapper<PType>, BOOST_PP_CAT(key, _t)> Params; \
Chris@16 160 return Params(boost::ref(p)); \
Chris@16 161 } \
Chris@16 162
Chris@16 163 #define BOOST_BGL_ONE_PARAM_CREF(name, key) \
Chris@16 164 template <typename PType> \
Chris@16 165 bgl_named_params<PType, BOOST_PP_CAT(key, _t)> \
Chris@16 166 name(const PType& p) { \
Chris@16 167 typedef bgl_named_params<PType, BOOST_PP_CAT(key, _t)> Params; \
Chris@16 168 return Params(p); \
Chris@16 169 } \
Chris@16 170
Chris@16 171 BOOST_BGL_DECLARE_NAMED_PARAMS
Chris@16 172
Chris@16 173 #undef BOOST_BGL_ONE_PARAM_REF
Chris@16 174 #undef BOOST_BGL_ONE_PARAM_CREF
Chris@16 175
Chris@16 176 // Duplicate
Chris@16 177 template <typename PType>
Chris@16 178 bgl_named_params<PType, vertex_color_t>
Chris@16 179 vertex_color_map(const PType& p) {return color_map(p);}
Chris@16 180
Chris@16 181 namespace detail {
Chris@16 182 struct unused_tag_type {};
Chris@16 183 }
Chris@16 184 typedef bgl_named_params<char, detail::unused_tag_type> no_named_parameters;
Chris@16 185
Chris@16 186 //===========================================================================
Chris@16 187 // Functions for extracting parameters from bgl_named_params
Chris@16 188
Chris@16 189 template <typename Tag, typename Args>
Chris@16 190 struct lookup_named_param {};
Chris@16 191
Chris@16 192 template <typename T, typename Tag, typename Base>
Chris@16 193 struct lookup_named_param<Tag, bgl_named_params<T, Tag, Base> > {
Chris@16 194 typedef T type;
Chris@16 195 static const T& get(const bgl_named_params<T, Tag, Base>& p) {
Chris@16 196 return p.m_value;
Chris@16 197 }
Chris@16 198 };
Chris@16 199
Chris@16 200 template <typename Tag1, typename T, typename Tag, typename Base>
Chris@16 201 struct lookup_named_param<Tag1, bgl_named_params<T, Tag, Base> > {
Chris@16 202 typedef typename lookup_named_param<Tag1, Base>::type type;
Chris@16 203 static const type& get(const bgl_named_params<T, Tag, Base>& p) {
Chris@16 204 return lookup_named_param<Tag1, Base>::get(p.m_base);
Chris@16 205 }
Chris@16 206 };
Chris@16 207
Chris@16 208 template <typename Tag, typename Args, typename Def>
Chris@16 209 struct lookup_named_param_def {
Chris@16 210 typedef Def type;
Chris@16 211 static const Def& get(const Args&, const Def& def) {return def;}
Chris@16 212 };
Chris@16 213
Chris@16 214 template <typename T, typename Tag, typename Base, typename Def>
Chris@16 215 struct lookup_named_param_def<Tag, bgl_named_params<T, Tag, Base>, Def> {
Chris@16 216 typedef T type;
Chris@16 217 static const type& get(const bgl_named_params<T, Tag, Base>& p, const Def&) {
Chris@16 218 return p.m_value;
Chris@16 219 }
Chris@16 220 };
Chris@16 221
Chris@16 222 template <typename Tag1, typename T, typename Tag, typename Base, typename Def>
Chris@16 223 struct lookup_named_param_def<Tag1, bgl_named_params<T, Tag, Base>, Def> {
Chris@16 224 typedef typename lookup_named_param_def<Tag1, Base, Def>::type type;
Chris@16 225 static const type& get(const bgl_named_params<T, Tag, Base>& p, const Def& def) {
Chris@16 226 return lookup_named_param_def<Tag1, Base, Def>::get(p.m_base, def);
Chris@16 227 }
Chris@16 228 };
Chris@16 229
Chris@16 230 struct param_not_found {};
Chris@16 231
Chris@16 232 template <typename Tag, typename Args>
Chris@16 233 struct get_param_type:
Chris@16 234 lookup_named_param_def<Tag, Args, param_not_found> {};
Chris@16 235
Chris@16 236 template <class Tag, typename Args>
Chris@16 237 inline
Chris@16 238 const typename lookup_named_param_def<Tag, Args, param_not_found>::type&
Chris@16 239 get_param(const Args& p, Tag) {
Chris@16 240 return lookup_named_param_def<Tag, Args, param_not_found>::get(p, param_not_found());
Chris@16 241 }
Chris@16 242
Chris@16 243 template <class P, class Default>
Chris@16 244 const P& choose_param(const P& param, const Default&) {
Chris@16 245 return param;
Chris@16 246 }
Chris@16 247
Chris@16 248 template <class Default>
Chris@16 249 Default choose_param(const param_not_found&, const Default& d) {
Chris@16 250 return d;
Chris@16 251 }
Chris@16 252
Chris@16 253 template <typename T>
Chris@16 254 inline bool is_default_param(const T&) { return false; }
Chris@16 255
Chris@16 256 inline bool is_default_param(const param_not_found&)
Chris@16 257 { return true; }
Chris@16 258
Chris@16 259 namespace detail {
Chris@16 260 template <typename T>
Chris@16 261 struct const_type_as_type {typedef typename T::const_type type;};
Chris@16 262 } // namespace detail
Chris@16 263
Chris@16 264
Chris@16 265 // Use this function instead of choose_param() when you want
Chris@16 266 // to avoid requiring get(tag, g) when it is not used.
Chris@16 267 namespace detail {
Chris@16 268 template <typename GraphIsConst, typename Graph, typename Param, typename Tag>
Chris@16 269 struct choose_impl_result:
Chris@16 270 boost::mpl::eval_if<
Chris@16 271 boost::is_same<Param, param_not_found>,
Chris@16 272 boost::mpl::eval_if<
Chris@16 273 GraphIsConst,
Chris@16 274 detail::const_type_as_type<property_map<Graph, Tag> >,
Chris@16 275 property_map<Graph, Tag> >,
Chris@16 276 boost::mpl::identity<Param> > {};
Chris@16 277
Chris@16 278 // Parameters of f are (GraphIsConst, Graph, Param, Tag)
Chris@16 279 template <bool Found> struct choose_impl_helper;
Chris@16 280
Chris@16 281 template <> struct choose_impl_helper<false> {
Chris@16 282 template <typename Param, typename Graph, typename PropertyTag>
Chris@16 283 static typename property_map<typename boost::remove_const<Graph>::type, PropertyTag>::const_type
Chris@16 284 f(boost::mpl::true_, const Graph& g, const Param&, PropertyTag tag) {
Chris@16 285 return get(tag, g);
Chris@16 286 }
Chris@16 287
Chris@16 288 template <typename Param, typename Graph, typename PropertyTag>
Chris@16 289 static typename property_map<typename boost::remove_const<Graph>::type, PropertyTag>::type
Chris@16 290 f(boost::mpl::false_, Graph& g, const Param&, PropertyTag tag) {
Chris@16 291 return get(tag, g);
Chris@16 292 }
Chris@16 293 };
Chris@16 294
Chris@16 295 template <> struct choose_impl_helper<true> {
Chris@16 296 template <typename GraphIsConst, typename Param, typename Graph, typename PropertyTag>
Chris@16 297 static Param f(GraphIsConst, const Graph&, const Param& p, PropertyTag) {
Chris@16 298 return p;
Chris@16 299 }
Chris@16 300 };
Chris@16 301 }
Chris@16 302
Chris@16 303 template <typename Param, typename Graph, typename PropertyTag>
Chris@16 304 typename detail::choose_impl_result<boost::mpl::true_, Graph, Param, PropertyTag>::type
Chris@16 305 choose_const_pmap(const Param& p, const Graph& g, PropertyTag tag)
Chris@16 306 {
Chris@16 307 return detail::choose_impl_helper<!boost::is_same<Param, param_not_found>::value>
Chris@16 308 ::f(boost::mpl::true_(), g, p, tag);
Chris@16 309 }
Chris@16 310
Chris@16 311 template <typename Param, typename Graph, typename PropertyTag>
Chris@16 312 typename detail::choose_impl_result<boost::mpl::false_, Graph, Param, PropertyTag>::type
Chris@16 313 choose_pmap(const Param& p, Graph& g, PropertyTag tag)
Chris@16 314 {
Chris@16 315 return detail::choose_impl_helper<!boost::is_same<Param, param_not_found>::value>
Chris@16 316 ::f(boost::mpl::false_(), g, p, tag);
Chris@16 317 }
Chris@16 318
Chris@16 319 namespace detail {
Chris@16 320
Chris@16 321 // used in the max-flow algorithms
Chris@16 322 template <class Graph, class P, class T, class R>
Chris@16 323 struct edge_capacity_value
Chris@16 324 {
Chris@16 325 typedef bgl_named_params<P, T, R> Params;
Chris@16 326 typedef typename detail::choose_impl_result<boost::mpl::true_, Graph, typename get_param_type<Params, edge_capacity_t>::type, edge_capacity_t>::type CapacityEdgeMap;
Chris@16 327 typedef typename property_traits<CapacityEdgeMap>::value_type type;
Chris@16 328 };
Chris@16 329
Chris@16 330 }
Chris@16 331
Chris@16 332 // Declare all new tags
Chris@16 333 namespace graph {
Chris@16 334 namespace keywords {
Chris@16 335 #define BOOST_BGL_ONE_PARAM_REF(name, key) BOOST_PARAMETER_NAME(name)
Chris@16 336 #define BOOST_BGL_ONE_PARAM_CREF(name, key) BOOST_PARAMETER_NAME(name)
Chris@16 337 BOOST_BGL_DECLARE_NAMED_PARAMS
Chris@16 338 #undef BOOST_BGL_ONE_PARAM_REF
Chris@16 339 #undef BOOST_BGL_ONE_PARAM_CREF
Chris@16 340 }
Chris@16 341 }
Chris@16 342
Chris@16 343 namespace detail {
Chris@16 344 template <typename Tag> struct convert_one_keyword {};
Chris@16 345 #define BOOST_BGL_ONE_PARAM_REF(name, key) \
Chris@16 346 template <> \
Chris@16 347 struct convert_one_keyword<BOOST_PP_CAT(key, _t)> { \
Chris@16 348 typedef boost::graph::keywords::tag::name type; \
Chris@16 349 };
Chris@16 350 #define BOOST_BGL_ONE_PARAM_CREF(name, key) BOOST_BGL_ONE_PARAM_REF(name, key)
Chris@16 351 BOOST_BGL_DECLARE_NAMED_PARAMS
Chris@16 352 #undef BOOST_BGL_ONE_PARAM_REF
Chris@16 353 #undef BOOST_BGL_ONE_PARAM_CREF
Chris@16 354
Chris@16 355 template <typename T>
Chris@16 356 struct convert_bgl_params_to_boost_parameter {
Chris@16 357 typedef typename convert_one_keyword<typename T::tag_type>::type new_kw;
Chris@16 358 typedef boost::parameter::aux::tagged_argument<new_kw, const typename T::value_type> tagged_arg_type;
Chris@16 359 typedef convert_bgl_params_to_boost_parameter<typename T::next_type> rest_conv;
Chris@16 360 typedef boost::parameter::aux::arg_list<tagged_arg_type, typename rest_conv::type> type;
Chris@16 361 static type conv(const T& x) {
Chris@16 362 return type(tagged_arg_type(x.m_value), rest_conv::conv(x.m_base));
Chris@16 363 }
Chris@16 364 };
Chris@16 365
Chris@16 366 template <typename P, typename R>
Chris@16 367 struct convert_bgl_params_to_boost_parameter<bgl_named_params<P, int, R> > {
Chris@16 368 typedef convert_bgl_params_to_boost_parameter<R> rest_conv;
Chris@16 369 typedef typename rest_conv::type type;
Chris@16 370 static type conv(const bgl_named_params<P, int, R>& x) {
Chris@16 371 return rest_conv::conv(x.m_base);
Chris@16 372 }
Chris@16 373 };
Chris@16 374
Chris@16 375 template <>
Chris@16 376 struct convert_bgl_params_to_boost_parameter<boost::no_property> {
Chris@16 377 typedef boost::parameter::aux::empty_arg_list type;
Chris@16 378 static type conv(const boost::no_property&) {return type();}
Chris@16 379 };
Chris@16 380
Chris@16 381 template <>
Chris@16 382 struct convert_bgl_params_to_boost_parameter<boost::no_named_parameters> {
Chris@16 383 typedef boost::parameter::aux::empty_arg_list type;
Chris@16 384 static type conv(const boost::no_named_parameters&) {return type();}
Chris@16 385 };
Chris@16 386
Chris@16 387 struct bgl_parameter_not_found_type {};
Chris@16 388
Chris@16 389 template <typename ArgPack, typename KeywordType>
Chris@16 390 struct parameter_exists : boost::mpl::not_<boost::is_same<typename boost::parameter::binding<ArgPack, KeywordType, bgl_parameter_not_found_type>::type, bgl_parameter_not_found_type> > {};
Chris@16 391 }
Chris@16 392
Chris@16 393 #define BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(old_type, old_var) \
Chris@16 394 typedef typename boost::detail::convert_bgl_params_to_boost_parameter<old_type>::type arg_pack_type; \
Chris@16 395 arg_pack_type arg_pack = boost::detail::convert_bgl_params_to_boost_parameter<old_type>::conv(old_var);
Chris@16 396
Chris@16 397 namespace detail {
Chris@16 398
Chris@16 399 template <typename ArgType, typename Prop, typename Graph, bool Exists>
Chris@16 400 struct override_const_property_t {
Chris@16 401 typedef typename boost::remove_const<ArgType>::type result_type;
Chris@16 402 result_type operator()(const Graph&, const ArgType& a) const {return a;}
Chris@16 403 };
Chris@16 404
Chris@16 405 template <typename ArgType, typename Prop, typename Graph>
Chris@16 406 struct override_const_property_t<ArgType, Prop, Graph, false> {
Chris@16 407 typedef typename boost::property_map<Graph, Prop>::const_type result_type;
Chris@16 408 result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);}
Chris@16 409 };
Chris@16 410
Chris@16 411 template <typename ArgPack, typename Tag, typename Prop, typename Graph>
Chris@16 412 struct override_const_property_result {
Chris@16 413 typedef
Chris@16 414 typename override_const_property_t<
Chris@16 415 typename boost::parameter::value_type<ArgPack, Tag, int>::type,
Chris@16 416 Prop,
Chris@16 417 Graph,
Chris@16 418 boost::detail::parameter_exists<ArgPack, Tag>::value
Chris@16 419 >::result_type
Chris@16 420 type;
Chris@16 421 };
Chris@16 422
Chris@16 423 template <typename ArgPack, typename Tag, typename Prop, typename Graph>
Chris@16 424 typename override_const_property_result<ArgPack, Tag, Prop, Graph>::type
Chris@16 425 override_const_property(const ArgPack& ap, const boost::parameter::keyword<Tag>& t, const Graph& g, Prop) {
Chris@16 426 return override_const_property_t<
Chris@16 427 typename boost::parameter::value_type<ArgPack, Tag, int>::type,
Chris@16 428 Prop,
Chris@16 429 Graph,
Chris@16 430 boost::detail::parameter_exists<ArgPack, Tag>::value
Chris@16 431 >()(g, ap[t | 0]);
Chris@16 432 }
Chris@16 433
Chris@16 434 template <typename ArgType, typename Prop, typename Graph, bool Exists>
Chris@16 435 struct override_property_t {
Chris@16 436 typedef ArgType result_type;
Chris@16 437 result_type operator()(const Graph&, const typename boost::add_reference<ArgType>::type a) const {return a;}
Chris@16 438 };
Chris@16 439
Chris@16 440 template <typename ArgType, typename Prop, typename Graph>
Chris@16 441 struct override_property_t<ArgType, Prop, Graph, false> {
Chris@16 442 typedef typename boost::property_map<Graph, Prop>::type result_type;
Chris@16 443 result_type operator()(const Graph& g, const ArgType&) const {return get(Prop(), g);}
Chris@16 444 };
Chris@16 445
Chris@16 446 template <typename ArgPack, typename Tag, typename Prop, typename Graph>
Chris@16 447 struct override_property_result {
Chris@16 448 typedef
Chris@16 449 typename override_property_t<
Chris@16 450 typename boost::parameter::value_type<ArgPack, Tag, int>::type,
Chris@16 451 Prop,
Chris@16 452 Graph,
Chris@16 453 boost::detail::parameter_exists<ArgPack, Tag>::value
Chris@16 454 >::result_type
Chris@16 455 type;
Chris@16 456 };
Chris@16 457
Chris@16 458 template <typename ArgPack, typename Tag, typename Prop, typename Graph>
Chris@16 459 typename override_property_result<ArgPack, Tag, Prop, Graph>::type
Chris@16 460 override_property(const ArgPack& ap, const boost::parameter::keyword<Tag>& t, const Graph& g, Prop) {
Chris@16 461 return override_property_t<
Chris@16 462 typename boost::parameter::value_type<ArgPack, Tag, int>::type,
Chris@16 463 Prop,
Chris@16 464 Graph,
Chris@16 465 boost::detail::parameter_exists<ArgPack, Tag>::value
Chris@16 466 >()(g, ap[t | 0]);
Chris@16 467 }
Chris@16 468
Chris@16 469 template <typename F> struct make_arg_pack_type;
Chris@16 470 template <> struct make_arg_pack_type<void()> {typedef boost::parameter::aux::empty_arg_list type;};
Chris@16 471 template <typename K, typename A>
Chris@16 472 struct make_arg_pack_type<void(K, A)> {
Chris@16 473 typedef boost::parameter::aux::tagged_argument<K, A> type;
Chris@16 474 };
Chris@16 475
Chris@16 476 #define BOOST_GRAPH_OPENING_PART_OF_PAIR(z, i, n) boost::parameter::aux::arg_list<boost::parameter::aux::tagged_argument<BOOST_PP_CAT(Keyword, BOOST_PP_SUB(n, i)), BOOST_PP_CAT(Arg, BOOST_PP_SUB(n, i))>,
Chris@16 477 #define BOOST_GRAPH_MAKE_PAIR_PARAM(z, i, _) const boost::parameter::aux::tagged_argument<BOOST_PP_CAT(Keyword, i), BOOST_PP_CAT(Arg, i)>& BOOST_PP_CAT(kw, i)
Chris@16 478
Chris@16 479 #define BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION(z, i, _) \
Chris@16 480 template <BOOST_PP_ENUM_PARAMS(i, typename Keyword), BOOST_PP_ENUM_PARAMS(i, typename Arg)> \
Chris@16 481 struct make_arg_pack_type<void(BOOST_PP_ENUM_PARAMS(i, Keyword), BOOST_PP_ENUM_PARAMS(i, Arg))> { \
Chris@16 482 typedef \
Chris@16 483 BOOST_PP_REPEAT(i, BOOST_GRAPH_OPENING_PART_OF_PAIR, BOOST_PP_DEC(i)) boost::parameter::aux::empty_arg_list BOOST_PP_REPEAT(i, > BOOST_PP_TUPLE_EAT(3), ~) \
Chris@16 484 type; \
Chris@16 485 };
Chris@16 486 BOOST_PP_REPEAT_FROM_TO(2, 11, BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION, ~)
Chris@16 487 #undef BOOST_GRAPH_MAKE_AP_TYPE_SPECIALIZATION
Chris@16 488
Chris@16 489 #define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION(name, nfixed, nnamed_max) \
Chris@16 490 /* Entry point for conversion from BGL-style named parameters */ \
Chris@16 491 template <BOOST_PP_ENUM_PARAMS(nfixed, typename Param) BOOST_PP_COMMA_IF(nfixed) typename ArgPack> \
Chris@16 492 typename boost::result_of< \
Chris@16 493 detail::BOOST_PP_CAT(name, _impl)<BOOST_PP_ENUM_PARAMS(nfixed, Param)>(BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) const ArgPack&) \
Chris@16 494 >::type \
Chris@16 495 BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) BOOST_PP_COMMA_IF(nfixed) const ArgPack& arg_pack) { \
Chris@16 496 return detail::BOOST_PP_CAT(name, _impl)<BOOST_PP_ENUM_PARAMS(nfixed, Param)>()(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \
Chris@16 497 } \
Chris@16 498 /* Individual functions taking Boost.Parameter-style keyword arguments */ \
Chris@16 499 BOOST_PP_REPEAT(BOOST_PP_INC(nnamed_max), BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONE, (name)(nfixed))
Chris@16 500
Chris@16 501 #define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONE(z, nnamed, seq) \
Chris@16 502 BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONEX(z, nnamed, BOOST_PP_SEQ_ELEM(0, seq), BOOST_PP_SEQ_ELEM(1, seq))
Chris@16 503
Chris@16 504 #define BOOST_GRAPH_MAKE_FORWARDING_FUNCTION_ONEX(z, nnamed, name, nfixed) \
Chris@16 505 template <BOOST_PP_ENUM_PARAMS(nfixed, typename Param) BOOST_PP_ENUM_TRAILING_PARAMS(nnamed, typename Keyword) BOOST_PP_ENUM_TRAILING_PARAMS(nnamed, typename Arg)> \
Chris@16 506 typename boost::result_of< \
Chris@16 507 detail::BOOST_PP_CAT(name, _impl)<BOOST_PP_ENUM_PARAMS(nfixed, Param)> \
Chris@16 508 (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) \
Chris@16 509 const typename boost::detail::make_arg_pack_type<void(BOOST_PP_ENUM_PARAMS(nnamed, Keyword) BOOST_PP_COMMA_IF(nnamed) BOOST_PP_ENUM_PARAMS(nnamed, Arg))>::type&) \
Chris@16 510 >::type \
Chris@16 511 name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) \
Chris@16 512 BOOST_PP_ENUM_TRAILING(nnamed, BOOST_GRAPH_MAKE_PAIR_PARAM, ~)) { \
Chris@16 513 return detail::BOOST_PP_CAT(name, _impl)<BOOST_PP_ENUM_PARAMS(nfixed, Param)>() \
Chris@16 514 (BOOST_PP_ENUM_PARAMS(nfixed, param), \
Chris@16 515 (boost::parameter::aux::empty_arg_list() BOOST_PP_ENUM_TRAILING_PARAMS(nnamed, kw))); \
Chris@16 516 }
Chris@16 517
Chris@16 518 #define BOOST_GRAPH_MAKE_OLD_STYLE_PARAMETER_FUNCTION(name, nfixed) \
Chris@16 519 template <BOOST_PP_ENUM_PARAMS(nfixed, typename Param) BOOST_PP_COMMA_IF(nfixed) class P, class T, class R> \
Chris@16 520 typename boost::result_of< \
Chris@16 521 ::boost::graph::detail::BOOST_PP_CAT(name, _impl) BOOST_PP_EXPR_IF(nfixed, <) BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_EXPR_IF(nfixed, >) \
Chris@16 522 (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) \
Chris@16 523 const typename boost::detail::convert_bgl_params_to_boost_parameter<boost::bgl_named_params<P, T, R> >::type &) \
Chris@16 524 >::type \
Chris@16 525 name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param) BOOST_PP_COMMA_IF(nfixed) const boost::bgl_named_params<P, T, R>& old_style_params) { \
Chris@16 526 typedef boost::bgl_named_params<P, T, R> old_style_params_type; \
Chris@16 527 BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(old_style_params_type, old_style_params) \
Chris@16 528 return ::boost::graph::BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \
Chris@16 529 } \
Chris@16 530 \
Chris@16 531 BOOST_PP_EXPR_IF(nfixed, template <) BOOST_PP_ENUM_PARAMS(nfixed, typename Param) BOOST_PP_EXPR_IF(nfixed, >) \
Chris@16 532 BOOST_PP_EXPR_IF(nfixed, typename) boost::result_of< \
Chris@16 533 ::boost::graph::detail::BOOST_PP_CAT(name, _impl) BOOST_PP_EXPR_IF(nfixed, <) BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_EXPR_IF(nfixed, >) \
Chris@16 534 (BOOST_PP_ENUM_PARAMS(nfixed, Param) BOOST_PP_COMMA_IF(nfixed) const boost::parameter::aux::empty_arg_list &) \
Chris@16 535 >::type \
Chris@16 536 name(BOOST_PP_ENUM_BINARY_PARAMS(nfixed, const Param, & param)) { \
Chris@16 537 BOOST_GRAPH_DECLARE_CONVERTED_PARAMETERS(boost::no_named_parameters, boost::no_named_parameters()) \
Chris@16 538 return ::boost::graph::BOOST_PP_CAT(name, _with_named_params)(BOOST_PP_ENUM_PARAMS(nfixed, param) BOOST_PP_COMMA_IF(nfixed) arg_pack); \
Chris@16 539 }
Chris@16 540
Chris@16 541 }
Chris@16 542
Chris@16 543 namespace detail {
Chris@16 544
Chris@16 545 template <bool Exists, typename Graph, typename ArgPack, typename Value, typename PM>
Chris@16 546 struct map_maker_helper {
Chris@16 547 typedef PM map_type;
Chris@16 548 static PM make_map(const Graph&, Value, const PM& pm, const ArgPack&) {
Chris@16 549 return pm;
Chris@16 550 }
Chris@16 551 };
Chris@16 552
Chris@16 553 template <typename Graph, typename ArgPack, typename Value, typename PM>
Chris@16 554 struct map_maker_helper<false, Graph, ArgPack, Value, PM> {
Chris@16 555 typedef typename boost::remove_const<
Chris@16 556 typename override_const_property_t<
Chris@16 557 typename boost::parameter::value_type<
Chris@16 558 ArgPack, boost::graph::keywords::tag::vertex_index_map, int>::type,
Chris@16 559 boost::vertex_index_t,
Chris@16 560 Graph,
Chris@16 561 boost::detail::parameter_exists<
Chris@16 562 ArgPack, boost::graph::keywords::tag::vertex_index_map>::value
Chris@16 563 >::result_type>::type vi_map_type;
Chris@16 564 typedef
Chris@16 565 boost::shared_array_property_map<Value, vi_map_type>
Chris@16 566 map_type;
Chris@16 567 static map_type make_map(const Graph& g,
Chris@16 568 Value v,
Chris@16 569 const PM&,
Chris@16 570 const ArgPack& ap) {
Chris@16 571 return make_shared_array_property_map(
Chris@16 572 num_vertices(g),
Chris@16 573 v,
Chris@16 574 override_const_property(
Chris@16 575 ap,
Chris@16 576 boost::graph::keywords::_vertex_index_map,
Chris@16 577 g, vertex_index));
Chris@16 578 }
Chris@16 579 };
Chris@16 580
Chris@16 581 template <typename Graph, typename ArgPack, typename MapTag, typename ValueType>
Chris@16 582 struct map_maker {
Chris@16 583 BOOST_STATIC_CONSTANT(
Chris@16 584 bool,
Chris@16 585 has_map =
Chris@16 586 (parameter_exists<ArgPack, MapTag>
Chris@16 587 ::value));
Chris@16 588 typedef map_maker_helper<has_map, Graph, ArgPack, ValueType,
Chris@16 589 typename boost::remove_const<
Chris@16 590 typename boost::parameter::value_type<
Chris@16 591 ArgPack,
Chris@16 592 MapTag,
Chris@16 593 int
Chris@16 594 >::type
Chris@16 595 >::type> helper;
Chris@16 596 typedef typename helper::map_type map_type;
Chris@16 597 static map_type make_map(const Graph& g, const ArgPack& ap, ValueType default_value) {
Chris@16 598 return helper::make_map(g, default_value, ap[::boost::parameter::keyword<MapTag>::instance | 0], ap);
Chris@16 599 }
Chris@16 600 };
Chris@16 601
Chris@16 602 template <typename MapTag, typename ValueType = void>
Chris@16 603 class make_property_map_from_arg_pack_gen {
Chris@16 604 ValueType default_value;
Chris@16 605
Chris@16 606 public:
Chris@16 607 make_property_map_from_arg_pack_gen(ValueType default_value)
Chris@16 608 : default_value(default_value) {}
Chris@16 609
Chris@16 610 template <typename Graph, typename ArgPack>
Chris@16 611 typename map_maker<Graph, ArgPack, MapTag, ValueType>::map_type
Chris@16 612 operator()(const Graph& g, const ArgPack& ap) const {
Chris@16 613 return map_maker<Graph, ArgPack, MapTag, ValueType>::make_map(g, ap, default_value);
Chris@16 614 }
Chris@16 615 };
Chris@16 616
Chris@16 617 template <typename MapTag>
Chris@16 618 class make_property_map_from_arg_pack_gen<MapTag, void> {
Chris@16 619 public:
Chris@16 620 template <typename ValueType, typename Graph, typename ArgPack>
Chris@16 621 typename map_maker<Graph, ArgPack, MapTag, ValueType>::map_type
Chris@16 622 operator()(const Graph& g, const ArgPack& ap, ValueType default_value) const {
Chris@16 623 return map_maker<Graph, ArgPack, MapTag, ValueType>::make_map(g, ap, default_value);
Chris@16 624 }
Chris@16 625 };
Chris@16 626
Chris@16 627 static const
Chris@16 628 make_property_map_from_arg_pack_gen<
Chris@16 629 boost::graph::keywords::tag::color_map,
Chris@16 630 default_color_type>
Chris@16 631 make_color_map_from_arg_pack(white_color);
Chris@16 632
Chris@16 633 template <bool Exists, class Graph, class ArgPack, class KeyT, class ValueT, class KeyMapTag, class IndexInHeapMapTag, class Compare, class Q>
Chris@16 634 struct priority_queue_maker_helper {
Chris@16 635 typedef Q priority_queue_type;
Chris@16 636
Chris@16 637 static priority_queue_type
Chris@16 638 make_queue(const Graph&, const ArgPack&, KeyT, const Q& q) {
Chris@16 639 return q;
Chris@16 640 }
Chris@16 641 };
Chris@16 642
Chris@16 643 template <class Graph, class ArgPack, class KeyT, class ValueT, class KeyMapTag, class IndexInHeapMapTag, class Compare, class Q>
Chris@16 644 struct priority_queue_maker_helper<false, Graph, ArgPack, KeyT, ValueT, KeyMapTag, IndexInHeapMapTag, Compare, Q> {
Chris@16 645 typedef typename std::vector<ValueT>::size_type default_index_in_heap_type;
Chris@16 646 typedef typename map_maker<Graph, ArgPack, IndexInHeapMapTag, default_index_in_heap_type>::helper::map_type index_in_heap_map;
Chris@16 647 typedef boost::d_ary_heap_indirect<ValueT, 4, index_in_heap_map, typename map_maker<Graph, ArgPack, KeyMapTag, KeyT>::helper::map_type, Compare> priority_queue_type;
Chris@16 648
Chris@16 649 static priority_queue_type
Chris@16 650 make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey, const Q&) {
Chris@16 651 return priority_queue_type(
Chris@16 652 map_maker<Graph, ArgPack, KeyMapTag, KeyT>::make_map(g, ap, defaultKey),
Chris@16 653 map_maker<Graph, ArgPack, IndexInHeapMapTag, default_index_in_heap_type>::make_map(g, ap, typename boost::property_traits<index_in_heap_map>::value_type(-1))
Chris@16 654 );
Chris@16 655 }
Chris@16 656 };
Chris@16 657
Chris@16 658 template <class Graph, class ArgPack, class KeyT, class ValueT, class PriorityQueueTag, class KeyMapTag, class IndexInHeapMapTag, class Compare>
Chris@16 659 struct priority_queue_maker {
Chris@16 660 BOOST_STATIC_CONSTANT(
Chris@16 661 bool,
Chris@16 662 g_hasQ =
Chris@16 663 (parameter_exists<ArgPack, PriorityQueueTag>
Chris@16 664 ::value));
Chris@16 665 typedef boost::reference_wrapper<int> int_refw;
Chris@16 666 typedef typename boost::parameter::value_type<
Chris@16 667 ArgPack,
Chris@16 668 PriorityQueueTag,
Chris@16 669 int_refw
Chris@16 670 >::type
Chris@16 671 param_value_type_wrapper;
Chris@16 672 typedef typename param_value_type_wrapper::type
Chris@16 673 param_value_type;
Chris@16 674 typedef typename boost::remove_const<param_value_type>::type param_value_type_no_const;
Chris@16 675 typedef priority_queue_maker_helper<g_hasQ, Graph, ArgPack, KeyT, ValueT, KeyMapTag, IndexInHeapMapTag, Compare,
Chris@16 676 param_value_type_no_const> helper;
Chris@16 677 typedef typename helper::priority_queue_type priority_queue_type;
Chris@16 678
Chris@16 679 static priority_queue_type make_queue(const Graph& g, const ArgPack& ap, KeyT defaultKey) {
Chris@16 680 return helper::make_queue(g, ap, defaultKey, ap[::boost::parameter::keyword<PriorityQueueTag>::instance | 0]);
Chris@16 681 }
Chris@16 682 };
Chris@16 683
Chris@16 684 template <class PriorityQueueTag, class KeyT, class ValueT, class Compare = std::less<KeyT>, class KeyMapTag = boost::graph::keywords::tag::distance_map, class IndexInHeapMapTag = boost::graph::keywords::tag::index_in_heap_map>
Chris@16 685 struct make_priority_queue_from_arg_pack_gen {
Chris@16 686 KeyT defaultKey;
Chris@16 687
Chris@16 688 make_priority_queue_from_arg_pack_gen(KeyT defaultKey_) : defaultKey(defaultKey_) { }
Chris@16 689
Chris@16 690 template <class F>
Chris@16 691 struct result {
Chris@16 692 typedef typename remove_const<typename remove_reference<typename function_traits<F>::arg1_type>::type>::type graph_type;
Chris@16 693 typedef typename remove_const<typename remove_reference<typename function_traits<F>::arg2_type>::type>::type arg_pack_type;
Chris@16 694 typedef typename priority_queue_maker<graph_type, arg_pack_type, KeyT, ValueT, PriorityQueueTag, KeyMapTag, IndexInHeapMapTag, Compare>::priority_queue_type type;
Chris@16 695 };
Chris@16 696
Chris@16 697 template <class Graph, class ArgPack>
Chris@16 698 typename priority_queue_maker<Graph, ArgPack, KeyT, ValueT, PriorityQueueTag, KeyMapTag, IndexInHeapMapTag, Compare>::priority_queue_type
Chris@16 699 operator()(const Graph& g, const ArgPack& ap) const {
Chris@16 700 return priority_queue_maker<Graph, ArgPack, KeyT, ValueT, PriorityQueueTag, KeyMapTag, IndexInHeapMapTag, Compare>::make_queue(g, ap, defaultKey);
Chris@16 701 }
Chris@16 702 };
Chris@16 703
Chris@16 704 template <typename G>
Chris@16 705 typename boost::graph_traits<G>::vertex_descriptor
Chris@16 706 get_null_vertex(const G&) {return boost::graph_traits<G>::null_vertex();}
Chris@16 707
Chris@16 708 template <typename G>
Chris@16 709 typename boost::graph_traits<G>::vertex_descriptor
Chris@16 710 get_default_starting_vertex(const G& g) {
Chris@16 711 std::pair<typename boost::graph_traits<G>::vertex_iterator, typename boost::graph_traits<G>::vertex_iterator> iters = vertices(g);
Chris@16 712 return (iters.first == iters.second) ? boost::graph_traits<G>::null_vertex() : *iters.first;
Chris@16 713 }
Chris@16 714
Chris@16 715 template <typename G>
Chris@16 716 struct get_default_starting_vertex_t {
Chris@16 717 typedef typename boost::graph_traits<G>::vertex_descriptor result_type;
Chris@16 718 const G& g;
Chris@16 719 get_default_starting_vertex_t(const G& g): g(g) {}
Chris@16 720 result_type operator()() const {return get_default_starting_vertex(g);}
Chris@16 721 };
Chris@16 722
Chris@16 723 // Wrapper to avoid instantiating numeric_limits when users provide distance_inf value manually
Chris@16 724 template <typename T>
Chris@16 725 struct get_max {
Chris@16 726 T operator()() const {
Chris@16 727 return (std::numeric_limits<T>::max)();
Chris@16 728 }
Chris@16 729 typedef T result_type;
Chris@16 730 };
Chris@16 731
Chris@16 732 } // namespace detail
Chris@16 733
Chris@16 734 } // namespace boost
Chris@16 735
Chris@16 736 #undef BOOST_BGL_DECLARE_NAMED_PARAMS
Chris@16 737
Chris@16 738 #endif // BOOST_GRAPH_NAMED_FUNCTION_PARAMS_HPP