property_map/doc/LvaluePropertyMap.html
2012-02-09 20:20:05 +00:00

142 lines
3.7 KiB
HTML

<HTML>
<!--
Copyright (c) Jeremy Siek 2000
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<Head>
<Title>LvaluePropertyMap</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b"
ALINK="#ff0000">
<IMG SRC="../../../boost.png"
ALT="C++ Boost" width="277" height="86">
<BR Clear>
<H2><A NAME="concept:LvaluePropertyMap"></A>
LvaluePropertyMap
</H2>
The LvaluePropertyMap provides <code>operator[]</code> and function <code>get()</code> for accessing a
reference to a value object. The return type refines that of function <code>get()</code>in <a
href="./ReadablePropertyMap.html">ReadablePropertyMap</a>; it can only be a reference (for a <I>mutable</I> LvaluePropertyMap) or a const reference (for a <I>non-mutable</I> LvaluePropertyMap).
<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&lt;PMap&gt;::key_type</tt>.</td>
</TR>
</table>
<h3>Associated Types</h3>
<table border>
<tr>
<td>Reference Type</td>
<td><TT>boost::property_traits&lt;PMap&gt;::reference</TT></td>
<td>
The reference type, which must be a reference or const reference to
the value type of the property map.
</td>
</tr>
<tr>
<td>Property Map Category
<td><TT>boost::property_traits&lt;PMap&gt;::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&amp;</TT> for mutable, <TT>const value_type&amp;</TT>
otherwise.
</TD>
<TD>Obtain a reference to the value associated with <TT>key</TT>.</TD>
</TR>
</TABLE>
<h3>Concept Checking Class</h3>
<pre> template &lt;class PMap, class Key&gt;
struct LvaluePropertyMapConcept
{
typedef typename property_traits&lt;PMap&gt;::category Category;
typedef boost::lvalue_property_map_tag LvalueTag;
typedef const typename property_traits&lt;PMap&gt;::value_type&amp; const_reference;
void constraints() {
function_requires&lt; ReadWritePropertyMapConcept&lt;PMap, Key&gt; &gt;();
function_requires&lt; ConvertibleConcept&lt;Category, LvalueTag&gt; &gt;();
const_reference ref = pmap[k];
}
PMap pmap;
Key k;
};
template &lt;class PMap, class Key&gt;
struct Mutable_LvaluePropertyMapConcept
{
typedef typename property_traits&lt;PMap&gt;::category Category;
typedef boost::lvalue_property_map_tag LvalueTag;
typedef typename property_traits&lt;PMap&gt;::value_type&amp; reference;
void constraints() {
function_requires&lt; ReadWritePropertyMapConcept&lt;PMap, Key&gt; &gt;();
function_requires&lt;ConvertibleConcept&lt;Category, LvalueTag&gt; &gt;();
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 &copy 2000</TD><TD>
<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>)
</TD></TR></TABLE>
</BODY>
</HTML>