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