Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r86603 - in trunk: boost/property_map libs/property_map/doc
From: jewillco_at_[hidden]
Date: 2013-11-09 14:04:41


Author: jewillco
Date: 2013-11-09 14:04:41 EST (Sat, 09 Nov 2013)
New Revision: 86603
URL: http://svn.boost.org/trac/boost/changeset/86603

Log:
Added optional key type for static_property_map; added make_static_property_map; documented static_property_map and the new stuff

Added:
   trunk/libs/property_map/doc/static_property_map.html
      - copied, changed from r86589, trunk/libs/property_map/doc/ref_property_map.html
Text files modified:
   trunk/boost/property_map/property_map.hpp | 10 +++++-
   trunk/libs/property_map/doc/property_map.html | 1
   trunk/libs/property_map/doc/ref_property_map.html | 4 +-
   trunk/libs/property_map/doc/static_property_map.html | 55 ++++++++++++++++++++++++---------------
   4 files changed, 45 insertions(+), 25 deletions(-)

Modified: trunk/boost/property_map/property_map.hpp
==============================================================================
--- trunk/boost/property_map/property_map.hpp Sat Nov 9 13:53:07 2013 (r86602)
+++ trunk/boost/property_map/property_map.hpp 2013-11-09 14:04:41 EST (Sat, 09 Nov 2013) (r86603)
@@ -486,14 +486,14 @@
   //=========================================================================
   // A property map that always returns the same object by value.
   //
- template <typename ValueType>
+ template <typename ValueType, typename KeyType = void>
   class static_property_map :
       public
   boost::put_get_helper<ValueType,static_property_map<ValueType> >
   {
     ValueType value;
   public:
- typedef void key_type;
+ typedef KeyType key_type;
     typedef ValueType value_type;
     typedef ValueType reference;
     typedef readable_property_map_tag category;
@@ -503,6 +503,12 @@
     inline reference operator[](T) const { return value; }
   };
 
+ template <typename KeyType, typename ValueType>
+ static_property_map<ValueType, KeyType>
+ make_static_property_map(const ValueType& v) {
+ return static_property_map<ValueType, KeyType>(v);
+ }
+
   //=========================================================================
   // A property map that always returns a reference to the same object.
   //

Modified: trunk/libs/property_map/doc/property_map.html
==============================================================================
--- trunk/libs/property_map/doc/property_map.html Sat Nov 9 13:53:07 2013 (r86602)
+++ trunk/libs/property_map/doc/property_map.html 2013-11-09 14:04:41 EST (Sat, 09 Nov 2013) (r86603)
@@ -291,6 +291,7 @@
   <li>const_associative_property_map</li>
   <li>vector_property_map</li>
   <li>ref_property_map </li>
+ <li>static_property_map </li>
   <li>transform_value_property_map </li>
   <li>compose_property_map </li>
 </ul>

Modified: trunk/libs/property_map/doc/ref_property_map.html
==============================================================================
--- trunk/libs/property_map/doc/ref_property_map.html Sat Nov 9 13:53:07 2013 (r86602)
+++ trunk/libs/property_map/doc/ref_property_map.html 2013-11-09 14:04:41 EST (Sat, 09 Nov 2013) (r86603)
@@ -47,7 +47,7 @@
 boost::property_traits&lt;ref_property_map&gt;::value_type
 </tt></td>
 <td>
-This type is the <tt>ValueType</tt> with which the template instantiated.
+This type is the <tt>ValueType</tt> with which the template was instantiated.
 </td>
 </tr>
 
@@ -56,7 +56,7 @@
 boost::property_traits&lt;ref_property_map&gt;::key_type
 </tt></td>
 <td>
-This type is the <tt>KeyType</tt> with which the template instantiated.
+This type is the <tt>KeyType</tt> with which the template was instantiated.
 </td>
 </tr>
 

Copied and modified: trunk/libs/property_map/doc/static_property_map.html (from r86589, trunk/libs/property_map/doc/ref_property_map.html)
==============================================================================
--- trunk/libs/property_map/doc/ref_property_map.html Fri Nov 8 16:23:37 2013 (r86589, copy source)
+++ trunk/libs/property_map/doc/static_property_map.html 2013-11-09 14:04:41 EST (Sat, 09 Nov 2013) (r86603)
@@ -1,6 +1,6 @@
 <HTML>
 <!--
- Copyright 2006 The Trustees of Indiana University
+ Copyright 2006, 2013 The Trustees of Indiana University
     
      Use, modification and distribution is subject to the Boost Software
      License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
@@ -8,7 +8,7 @@
     
   -->
 <Head>
-<Title>Reference Property Map</Title>
+<Title>Static Property Map</Title>
 <BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
         ALINK="#ff0000">
 <IMG SRC="../../../boost.png"
@@ -16,15 +16,15 @@
 
 <BR Clear>
 
-<H2><A NAME="sec:identity-property-map"></A>
+<H2><A NAME="sec:static-property-map"></A>
 </h2>
 <PRE>
-template &lt;typename KeyType, typename ValueType&gt;
-class ref_property_map
+template &lt;typename ValueType, typename KeyType = void&gt;
+class static_property_map
 </PRE>
 
-This property map wraps a reference to some particular object, and
-returns that reference whenever a key object is input.
+This property map wraps a copy of some particular object, and
+returns a copy of that object whenever a key object is input.
 
 <H3>Where Defined</H3>
 
@@ -33,7 +33,7 @@
 
 <h3>Model of</h3>
 
-Lvalue Property Map
+Readable Property Map
 
 <h3>Associated Types</h3>
 
@@ -44,28 +44,28 @@
 
 <tr>
 <td><tt>
-boost::property_traits&lt;ref_property_map&gt;::value_type
+boost::property_traits&lt;static_property_map&gt;::value_type
 </tt></td>
 <td>
-This type is the <tt>ValueType</tt> with which the template instantiated.
+This type is the <tt>ValueType</tt> with which the template was instantiated.
 </td>
 </tr>
 
 <tr>
 <td><tt>
-boost::property_traits&lt;ref_property_map&gt;::key_type
+boost::property_traits&lt;static_property_map&gt;::key_type
 </tt></td>
 <td>
-This type is the <tt>KeyType</tt> with which the template instantiated.
+This type is the <tt>KeyType</tt> with which the template was instantiated.
 </td>
 </tr>
 
 <tr>
 <td><tt>
-boost::property_traits&lt;ref_property_map&gt;::category
+boost::property_traits&lt;static_property_map&gt;::category
 </tt></td>
 <td>
-This type is <tt>boost::lvalue_property_map_tag</tt>.
+This type is <tt>boost::readable_property_map_tag</tt>.
 </td>
 </tr>
 
@@ -81,17 +81,17 @@
 
 <tr>
 <td><tt>
-ref_property_map(ValueType&amp; v)
+static_property_map(ValueType v)
 </tt></td>
 <td>
-The constructor for ref_property_map is provided the reference that
+The constructor for static_property_map is provided the value that
 the property map will return when queried.
 </td>
 </tr>
 
 <tr>
 <td><tt>
-ref_property_map(const ref_property_map&amp; x)
+static_property_map(const static_property_map&amp; x)
 </tt></td>
 <td>
 Copy constructor.
@@ -99,16 +99,29 @@
 </tr>
 
 <tr>
-<td><tt>
-ValueType&amp; operator[](KeyType const&amp;) const
-</tt></td>
+<td><pre>
+template &lt;typename T&gt;
+ValueType&amp; operator[](T) const
+</pre></td>
 <td>
-Returns the contained reference.
+Returns the contained value by copy.
 </td>
 </tr>
 
 </table>
 
+<h3>Non-Member Functions</h3>
+
+<table border>
+<tr><td><pre>
+template &lt;typename KeyType, typename ValueType&gt;
+static_property_map&lt;KeyType, ValueType&gt;
+make_static_property_map(const ValueType&amp; value);
+</pre></td>
+<td>Returns a <tt>static_property_map</tt> with the given key type initialized to the given value.</td>
+</tr>
+</table>
+
 
 </BODY>
 </HTML>


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk