Chris@16
|
1 // (C) Copyright Andrew Sutton 2007
|
Chris@16
|
2 //
|
Chris@16
|
3 // Use, modification and distribution are subject to the
|
Chris@16
|
4 // Boost Software License, Version 1.0 (See accompanying file
|
Chris@16
|
5 // LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
Chris@16
|
6
|
Chris@16
|
7 #ifndef BOOST_GRAPH_NULL_PROPERTY_HPP
|
Chris@16
|
8 #define BOOST_GRAPH_NULL_PROPERTY_HPP
|
Chris@16
|
9
|
Chris@16
|
10 #include <boost/property_map/property_map.hpp>
|
Chris@16
|
11
|
Chris@16
|
12 // TODO: This should really be part of the property maps library rather than
|
Chris@16
|
13 // the Boost.Graph library.
|
Chris@16
|
14
|
Chris@16
|
15 namespace boost
|
Chris@16
|
16 {
|
Chris@16
|
17 // A null property is somewhat like the inverse of the constant
|
Chris@16
|
18 // property map except that instead of returning a single value,
|
Chris@16
|
19 // this eats any writes and cannot be read from.
|
Chris@16
|
20
|
Chris@16
|
21 template <typename Key, typename Value>
|
Chris@16
|
22 struct null_property_map
|
Chris@16
|
23 {
|
Chris@16
|
24 typedef Key key_type;
|
Chris@16
|
25 typedef Value value_type;
|
Chris@16
|
26 typedef void reference;
|
Chris@16
|
27 typedef boost::writable_property_map_tag category;
|
Chris@16
|
28 };
|
Chris@16
|
29
|
Chris@16
|
30 // The null_property_map<K,V> only has a put() function.
|
Chris@16
|
31 template <typename K, typename V>
|
Chris@16
|
32 void put(null_property_map<K,V>& /*pm*/, const K& /*key*/, const V& /*value*/)
|
Chris@16
|
33 { }
|
Chris@16
|
34
|
Chris@16
|
35 // A helper function for intantiating null property maps.
|
Chris@16
|
36 template <typename Key, typename Value>
|
Chris@16
|
37 inline null_property_map<Key, Value> make_null_property()
|
Chris@16
|
38 { return null_property_map<Key, Value>(); }
|
Chris@16
|
39 }
|
Chris@16
|
40
|
Chris@16
|
41 #endif
|