From 549db6db29bbd9e729a64598bf486a86bf6a624c Mon Sep 17 00:00:00 2001 From: Andrew Sutton Date: Mon, 20 Apr 2009 14:49:29 +0000 Subject: [PATCH] Importing null (no-op) property map from SOC/2007. [SVN r52510] --- .../graph/property_maps/null_property_map.hpp | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 include/boost/graph/property_maps/null_property_map.hpp diff --git a/include/boost/graph/property_maps/null_property_map.hpp b/include/boost/graph/property_maps/null_property_map.hpp new file mode 100644 index 00000000..2d30eea8 --- /dev/null +++ b/include/boost/graph/property_maps/null_property_map.hpp @@ -0,0 +1,38 @@ +// (C) Copyright Andrew Sutton 2007 +// +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0 (See accompanying file +// LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +#ifndef BOOST_GRAPH_NULL_PROPERTY_HPP +#define BOOST_GRAPH_NULL_PROPERTY_HPP + +#include + +namespace boost +{ + // A null property is somewhat like the inverse of the constant + // property map except that instead of returning a single value, + // this eats any writes and cannot be read from. + + template + struct null_property_map + { + typedef Key key_type; + typedef Value value_type; + typedef void reference; + typedef boost::writable_property_map_tag category; + }; + + // The null_property_map only has a put() function. + template + void put(null_property_map& pm, const K& key, const V& value) + { } + + // A helper function for intantiating null property maps. + template + inline null_property_map make_null_property() + { return null_property_map(); } +} + +#endif