PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/graph/property_maps/null_property_map.hpp

http://hadesmem.googlecode.com/
C++ Header | 41 lines | 21 code | 8 blank | 12 comment | 0 complexity | 0690499e7955d3f4e590d70b3a137283 MD5 | raw file
 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
15namespace 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>
22    struct null_property_map
23    {
24        typedef Key key_type;
25        typedef Value value_type;
26        typedef void reference;
27        typedef boost::writable_property_map_tag category;
28    };
29
30    // The null_property_map<K,V> only has a put() function.
31    template <typename K, typename V>
32    void put(null_property_map<K,V>& pm, const K& key, const V& value)
33    { }
34
35    // A helper function for intantiating null property maps.
36    template <typename Key, typename Value>
37    inline null_property_map<Key, Value> make_null_property()
38    { return null_property_map<Key, Value>(); }
39}
40
41#endif