1<HTML> 2<!-- 3 Copyright (c) Jeremy Siek 2000 4 5 Distributed under the Boost Software License, Version 1.0. 6 (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 --> 9<Head> 10<Title>WritablePropertyMap</Title> 11<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 12 ALINK="#ff0000"> 13<IMG SRC="../../../boost.png" 14 ALT="C++ Boost" width="277" height="86"> 15 16<BR Clear> 17 18 19<H2><A NAME="concept:WritablePropertyMap"></A> 20Writable Property Map 21</H2> 22 23A Writable Property Map has the capability of setting the value 24object associated with the given key object via the <tt>put()</tt> 25function. 26 27<h3>Refinement of</h3> 28 29<a href="../../utility/CopyConstructible.html">Copy Constructible</a> 30 31 32<h3>Notation</h3> 33 34<Table> 35<TR> 36<TD><tt>PMap</tt></TD> 37<TD>A type that is a model of Writable Property Map.</TD> 38</TR> 39<TR> 40<TD><tt>pmap</tt></TD> 41<TD>An object of type <tt>PMap</tt>.</td> 42</TR> 43<TR> 44<TD><tt>key</tt></TD> 45<TD>An object of type <tt>boost::property_traits<PMap>::key_type</tt>.</td> 46</TR> 47<TR> 48<TD><tt>val</tt></TD> 49<TD>An object of type <tt>boost::property_traits<PMap>::value_type</tt>.</td> 50</TR> 51</table> 52 53<h3>Associated Types</h3> 54 55<table border> 56 57<tr> 58<td>Value Type</td> 59<td><TT>boost::property_traits<PMap>::value_type</TT></td> 60<td> 61The type of the property. 62</td> 63</tr> 64 65<tr> 66<td>Key Type</td> 67<td><TT>boost::property_traits<PMap>::key_type</TT></td> 68<td> 69The type of the key object used to look up the property. The property 70map may be templated on the key type, in which case this typedef 71can be <TT>void</TT>. 72</td> 73</tr> 74 75<tr> 76<td>Property Map Category </td> 77<td><TT>boost::property_traits<PMap>::category</TT></td> 78<td> 79The category of the property: a type convertible to 80<TT>writable_property_map_tag</TT>. 81</td> 82</tr> 83 84</table> 85 86 87<h3>Valid Expressions</h3> 88 89<table border> 90<tr> 91<th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th> 92</tr> 93 94<tr> 95<td>Put Property Value<a href="#1">[1]</a></td> 96<TD><TT>put(pmap, key, val)</TT></TD> 97<TD><TT>void</TT></TD> 98<TD> 99Assign <TT>val</TT> to the property associated with <TT>k</TT>. 100</TD> 101</TR> 102 103</TABLE> 104 105 106<h3>Notes</h3> 107 108<a name="1">[1]</a> The function <tt>put()</tt> was originally named 109<tt>set()</tt>, but was changed to avoid name conflicts with the 110<tt>std::set</tt> class when using a compiler (Microsoft Visual C++) 111with non-standard name lookup rules. The following example demonstrates 112the problem. 113<pre>#include <set> 114using namespace std; 115namespace boost { 116 void set() { } 117}</pre> 118 119 120<h3>Concept Checking Class</h3> 121 122<pre> template <class PMap, class Key> 123 struct WritablePropertyMapConcept 124 { 125 typedef typename property_traits<PMap>::key_type key_type; 126 typedef typename property_traits<PMap>::category Category; 127 typedef boost::writable_property_map_tag WritableTag; 128 void constraints() { 129 function_requires< ConvertibleConcept<Category, WritableTag> >(); 130 put(pmap, k, val); 131 } 132 PMap pmap; 133 Key k; 134 typename property_traits<PMap>::value_type val; 135 };</pre> 136 137<h3>See Also</h3> 138 139<a href="./property_map.html">Property map concepts</a> 140 141 142<br> 143<HR> 144<TABLE> 145<TR valign=top> 146<TD nowrap>Copyright © 2000</TD><TD> 147<a HREF="http://www.boost.org/people/jeremy_siek.htm">Jeremy Siek</a>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>) 148</TD></TR></TABLE> 149 150</BODY> 151</HTML> 152