1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
|
<HTML>
<!--
-- Copyright (c) Jeremy Siek 2000
--
-- Permission to use, copy, modify, distribute and sell this software
-- and its documentation for any purpose is hereby granted without fee,
-- provided that the above copyright notice appears in all copies and
-- that both that copyright notice and this permission notice appear
-- in supporting documentation. Silicon Graphics makes no
-- representations about the suitability of this software for any
-- purpose. It is provided "as is" without express or implied warranty.
-->
<Head>
<Title>LvaluePropertyMap</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
ALINK="#ff0000">
<IMG SRC="../../c++boost.gif"
ALT="C++ Boost" width="277" height="86">
<BR Clear>
<H2><A NAME="concept:LvaluePropertyMap"></A>
LvaluePropertyMap
</H2>
The LvaluePropertyMap provides an interface for accessing a
reference to a property object (instead of a copy of the object as in
the <TT>get()</TT> function required by <a
href="./ReadablePropertyMap.html">ReadablePropertyMap</a>). An
LvaluePropertyMap can be <I>mutable</I> or
<I>non-mutable</I>. The mutable LvaluePropertyMap returns a
reference whereas the non-mutable returns a const reference.
<H3>Refinement of</H3>
<a href="./ReadablePropertyMap.html">ReadablePropertyMap</a>
for non-mutable or <a href="./ReadWritePropertyMap.html">ReadWritePropertyMap</a> for mutable property map.
<h3>Notation</h3>
<Table>
<TR>
<TD><tt>PMap</tt></TD>
<TD>A type that is a model of LvaluePropertyMap.</TD>
</TR>
<TR>
<TD><tt>pmap</tt></TD>
<TD>An object of type <tt>PMap</tt>.</td>
</TR>
<TR>
<TD><tt>key</tt></TD>
<TD>An object of type <tt>boost::property_traits<PMap>::key_type</tt>.</td>
</TR>
</table>
<h3>Associated Types</h3>
<table border>
<tr>
<td>Reference Type</td>
<td><TT>boost::property_traits<PMap>::reference</TT></td>
<td>
The reference type, which must be a reference or const reference to
the value typeof the property map.
</td>
</tr>
<tr>
<td>Property Map Category
<td><TT>boost::property_traits<PMap>::category</TT></td>
<td>
The category of the property: a type convertible to
<TT>boost::lvalue_property_map_tag</TT>.
</td>
</tr>
</table>
<h3>Valid Expressions</h3>
<table border>
<tr>
<th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
</tr>
<tr>
<td>Access Property Value </td>
<TD><TT>pmap[key]</TT></TD>
<TD>
<TT>value_type&</TT> for mutable, <TT>const value_type&</TT>
otherwise.
</TD>
<TD>Obtain a reference to the property identified by <TT>key</TT>.</TD>
</TR>
</TABLE>
<h3>Concept Checking Class</h3>
<pre> template <class PMap, class Key>
struct LvaluePropertyMapConcept
{
typedef typename property_traits<PMap>::category Category;
typedef boost::lvalue_property_map_tag LvalueTag;
typedef const typename property_traits<PMap>::value_type& const_reference;
void constraints() {
function_requires< ReadWritePropertyMapConcept<PMap, Key> >();
function_requires< ConvertibleConcept<Category, LvalueTag> >();
const_reference ref = pmap[k];
}
PMap pmap;
Key k;
};
template <class PMap, class Key>
struct Mutable_LvaluePropertyMapConcept
{
typedef typename property_traits<PMap>::category Category;
typedef boost::lvalue_property_map_tag LvalueTag;
typedef typename property_traits<PMap>::value_type& reference;
void constraints() {
function_requires< ReadWritePropertyMapConcept<PMap, Key> >();
function_requires<ConvertibleConcept<Category, LvalueTag> >();
reference ref = pmap[k];
}
PMap pmap;
Key k;
};</pre>
<h3>See Also</h3>
<a href="./property_map.html">Property map concepts</a>
<br>
<HR>
<TABLE>
<TR valign=top>
<TD nowrap>Copyright © 2000</TD><TD>
<a HREF="../../people/jeremy_siek.htm">Jeremy Siek</a>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)
</TD></TR></TABLE>
</BODY>
</HTML>
|