boost/libs/hana/doc/html/structboost_1_1hana_1_1map.html
2021-10-05 21:37:46 +02:00

1230 lines
109 KiB
HTML

<!--
Copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-->
<!-- boost-no-inspect -->
<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.20"/>
<title>Boost.Hana: boost::hana::map&lt; Pairs &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
// Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
MathJax.Hub.Config({
"HTML-CSS": {
linebreaks: {
automatic: true,
width: "75% container"
}
}
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<!-- Additional javascript for drawing charts. -->
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript" src="highcharts-data.js"></script>
<script type="text/javascript" src="highcharts-exporting.js"></script>
<script type="text/javascript" src="chart.js"></script>
<script type="text/javascript" src="hana.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
<td style="padding-left: 0.5em;">
<div id="projectname">Boost.Hana
&#160;<span id="projectnumber">1.7.0</span>
</div>
<div id="projectbrief">Your standard library for metaprogramming</div>
</td>
<td> <div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.svg"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.20 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structboost_1_1hana_1_1map.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#related">Synopsis of associated functions</a> &#124;
<a href="#friends">Friends</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="structboost_1_1hana_1_1map-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">boost::hana::map&lt; Pairs &gt; Struct Template Reference<div class="ingroups"><a class="el" href="group__group-datatypes.html">Data types</a></div></div> </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<div class="textblock"><h3>template&lt;typename ... Pairs&gt;<br />
struct boost::hana::map&lt; Pairs &gt;</h3>
<p>Basic associative container requiring unique, <code>Comparable</code> and <code>Hashable</code> keys. </p>
<p>The order of the elements of the map is unspecified. Also, all the keys must be <code>Hashable</code>, and any two keys with equal hashes must be <code>Comparable</code> with each other at compile-time.</p>
<dl class="section note"><dt>Note</dt><dd>The actual representation of a <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a></code> is an implementation detail. As such, one should not assume anything more than what is explicitly documented as being part of the interface of a map, such as:<ul>
<li>the presence of additional constructors</li>
<li>the presence of additional assignment operators</li>
<li>the fact that <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a>&lt;Pairs...&gt;</code> is, or is not, a dependent type</li>
</ul>
In particular, the last point is very important; <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a>&lt;Pairs...&gt;</code> is basically equivalent to <div class="fragment"><div class="line">decltype(hana::make_pair(std::declval&lt;Pairs&gt;()...))</div>
</div><!-- fragment --> which is not something that can be pattern-matched on during template argument deduction, for example. More details <a class="el" href="index.html#tutorial-containers-types">in the tutorial</a>.</dd></dl>
<h2><a class="anchor" id="autotoc_md269"></a>
Modeled concepts</h2>
<ol type="1">
<li><code>Comparable</code><br />
Two maps are equal iff all their keys are equal and are associated to equal values. <div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::char_c&lt;&#39;a&#39;&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&amp;&amp;&gt;, <span class="keyword">nullptr</span>)</div>
<div class="line"> )</div>
<div class="line"> ==</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&amp;&amp;&gt;, (<span class="keywordtype">void</span>*)0),</div>
<div class="line"> hana::make_pair(hana::char_c&lt;&#39;a&#39;&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment --></li>
<li><code>Searchable</code><br />
A map can be searched by its keys with a predicate yielding a compile-time <code>Logical</code>. Also note that <code>operator[]</code> can be used instead of <code>at_key</code>. <div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="at__key_8hpp.html">boost/hana/at_key.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="equal_8hpp.html">boost/hana/equal.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="find_8hpp.html">boost/hana/find.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="optional_8hpp.html">boost/hana/optional.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line">constexpr <span class="keyword">auto</span> m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="charliteral">&#39;i&#39;</span>),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, <span class="charliteral">&#39;f&#39;</span>)</div>
<div class="line">);</div>
<div class="line">static_assert(<a class="code" href="group__group-_searchable.html#ga6b6cdd69942b0fe3bf5254247f9c861e">hana::find</a>(m, hana::type_c&lt;int&gt;) == hana::just(<span class="charliteral">&#39;i&#39;</span>), <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line">static_assert(<a class="code" href="group__group-_searchable.html#ga6b6cdd69942b0fe3bf5254247f9c861e">hana::find</a>(m, hana::type_c&lt;float&gt;) == hana::just(<span class="charliteral">&#39;f&#39;</span>), <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(<a class="code" href="group__group-_searchable.html#ga6b6cdd69942b0fe3bf5254247f9c861e">hana::find</a>(m, hana::type_c&lt;void&gt;) == hana::nothing);</div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(<a class="code" href="group__group-_searchable.html#ga6b6cdd69942b0fe3bf5254247f9c861e">hana::find</a>(m, hana::int_c&lt;3&gt;) == hana::nothing);</div>
<div class="line"> </div>
<div class="line"><span class="comment">// operator[] is equivalent to at_key</span></div>
<div class="line">static_assert(m[hana::type_c&lt;int&gt;] == <span class="charliteral">&#39;i&#39;</span>, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line">static_assert(m[hana::type_c&lt;float&gt;] == <span class="charliteral">&#39;f&#39;</span>, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() { }</div>
</div><!-- fragment --></li>
<li><code>Foldable</code><br />
Folding a map is equivalent to folding a list of the key/value pairs it contains. In particular, since that list is not guaranteed to be in any specific order, folding a map with an operation that is not both commutative and associative will yield non-deterministic behavior. <div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="first_8hpp.html">boost/hana/first.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="fold__left_8hpp.html">boost/hana/fold_left.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="insert_8hpp.html">boost/hana/insert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="second_8hpp.html">boost/hana/second.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="comment">// Given a map of (key, value) pairs, returns a map of (value, key) pairs.</span></div>
<div class="line"> <span class="comment">// This requires both the keys and the values to be compile-time Comparable.</span></div>
<div class="line"> <span class="keyword">auto</span> invert = [](<span class="keyword">auto</span> <a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>) {</div>
<div class="line"> <span class="keywordflow">return</span> hana::fold_left(<a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>, hana::make_map(), [](<span class="keyword">auto</span> <a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>, <span class="keyword">auto</span> pair) {</div>
<div class="line"> <span class="keywordflow">return</span> <a class="code" href="group__group-_sequence.html#gae22a1a184b1b2dd550fa4fa619bed2e9">hana::insert</a>(<a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>, hana::make_pair(<a class="code" href="group__group-_product.html#ga7bb979d59ffc3ab862cb7d9dc7730077">hana::second</a>(pair), <a class="code" href="group__group-_product.html#ga34bbf4281de06dc3540441e8b2bd24f4">hana::first</a>(pair)));</div>
<div class="line"> });</div>
<div class="line"> };</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">auto</span> m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, hana::int_c&lt;1&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, hana::int_c&lt;2&gt;),</div>
<div class="line"> hana::make_pair(hana::int_c&lt;3&gt;, hana::type_c&lt;void&gt;)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(invert(m) ==</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, hana::type_c&lt;int&gt;),</div>
<div class="line"> hana::make_pair(hana::int_c&lt;2&gt;, hana::type_c&lt;float&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, hana::int_c&lt;3&gt;)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment --></li>
</ol>
<h2><a class="anchor" id="autotoc_md270"></a>
Conversion from any &lt;tt&gt;Foldable&lt;/tt&gt;</h2>
<p>Any <code>Foldable</code> of <code>Product</code>s can be converted to a <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a></code> with <code><a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e" title="Converts an object from one data type to another.">hana::to</a>&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">hana::map_tag</a>&gt;</code> or, equivalently, <code>hana::to_map</code>. If the <code>Foldable</code> contains duplicate keys, only the value associated to the first occurence of each key is kept. </p><div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2to_8hpp.html">boost/hana/core/to.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="tuple_8hpp.html">boost/hana/tuple.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="keyword">auto</span> xs = hana::make_tuple(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="stringliteral">&quot;abcd&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="keyword">nullptr</span>)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::to&lt;hana::map_tag&gt;(xs) == hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="stringliteral">&quot;abcd&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md271"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="at__key_8hpp.html">boost/hana/at_key.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="contains_8hpp.html">boost/hana/contains.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="string_8hpp.html">boost/hana/string.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;functional&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> ...Events&gt;</div>
<div class="line"><span class="keyword">struct </span>event_system {</div>
<div class="line"> <span class="keyword">using</span> Callback = std::function&lt;void()&gt;;</div>
<div class="line"> hana::map&lt;hana::pair&lt;Events, std::vector&lt;Callback&gt;&gt;...&gt; map_;</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Event, <span class="keyword">typename</span> F&gt;</div>
<div class="line"> <span class="keywordtype">void</span> <a class="code" href="group__group-functional.html#ga35c4fc3c5677b9f558150b90e74d3ab1">on</a>(Event e, F handler) {</div>
<div class="line"> <span class="keyword">auto</span> is_known_event = <a class="code" href="group__group-_searchable.html#ga38e7748956cbc9f3d9bb035ac8577906">hana::contains</a>(map_, e);</div>
<div class="line"> static_assert(is_known_event,</div>
<div class="line"> <span class="stringliteral">&quot;trying to add a handler to an unknown event&quot;</span>);</div>
<div class="line"> </div>
<div class="line"> map_[e].push_back(handler);</div>
<div class="line"> }</div>
<div class="line"> </div>
<div class="line"> <span class="keyword">template</span> &lt;<span class="keyword">typename</span> Event&gt;</div>
<div class="line"> <span class="keywordtype">void</span> trigger(Event e)<span class="keyword"> const </span>{</div>
<div class="line"> <span class="keyword">auto</span> is_known_event = <a class="code" href="group__group-_searchable.html#ga38e7748956cbc9f3d9bb035ac8577906">hana::contains</a>(map_, e);</div>
<div class="line"> static_assert(is_known_event,</div>
<div class="line"> <span class="stringliteral">&quot;trying to trigger an unknown event&quot;</span>);</div>
<div class="line"> </div>
<div class="line"> <span class="keywordflow">for</span> (<span class="keyword">auto</span>&amp; handler : this-&gt;map_[e])</div>
<div class="line"> handler();</div>
<div class="line"> }</div>
<div class="line">};</div>
<div class="line"> </div>
<div class="line"><span class="keyword">template</span> &lt;<span class="keyword">typename</span> ...Events&gt;</div>
<div class="line">event_system&lt;Events...&gt; make_event_system(Events ...events) {</div>
<div class="line"> <span class="keywordflow">return</span> {};</div>
<div class="line">}</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="keyword">auto</span> events = make_event_system(</div>
<div class="line"> BOOST_HANA_STRING(<span class="stringliteral">&quot;foo&quot;</span>),</div>
<div class="line"> BOOST_HANA_STRING(<span class="stringliteral">&quot;bar&quot;</span>),</div>
<div class="line"> BOOST_HANA_STRING(<span class="stringliteral">&quot;baz&quot;</span>)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> std::vector&lt;std::string&gt; triggered_events;</div>
<div class="line"> events.on(BOOST_HANA_STRING(<span class="stringliteral">&quot;foo&quot;</span>), [&amp;] {</div>
<div class="line"> triggered_events.push_back(<span class="stringliteral">&quot;foo:1&quot;</span>);</div>
<div class="line"> });</div>
<div class="line"> events.on(BOOST_HANA_STRING(<span class="stringliteral">&quot;foo&quot;</span>), [&amp;] {</div>
<div class="line"> triggered_events.push_back(<span class="stringliteral">&quot;foo:2&quot;</span>);</div>
<div class="line"> });</div>
<div class="line"> events.on(BOOST_HANA_STRING(<span class="stringliteral">&quot;bar&quot;</span>), [&amp;] {</div>
<div class="line"> triggered_events.push_back(<span class="stringliteral">&quot;bar:1&quot;</span>);</div>
<div class="line"> });</div>
<div class="line"> events.on(BOOST_HANA_STRING(<span class="stringliteral">&quot;baz&quot;</span>), [&amp;] {</div>
<div class="line"> triggered_events.push_back(<span class="stringliteral">&quot;baz:1&quot;</span>);</div>
<div class="line"> });</div>
<div class="line"> </div>
<div class="line"> events.trigger(BOOST_HANA_STRING(<span class="stringliteral">&quot;foo&quot;</span>));</div>
<div class="line"> events.trigger(BOOST_HANA_STRING(<span class="stringliteral">&quot;bar&quot;</span>));</div>
<div class="line"> events.trigger(BOOST_HANA_STRING(<span class="stringliteral">&quot;baz&quot;</span>));</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(triggered_events == std::vector&lt;std::string&gt;{</div>
<div class="line"> <span class="stringliteral">&quot;foo:1&quot;</span>, <span class="stringliteral">&quot;foo:2&quot;</span>, <span class="stringliteral">&quot;bar:1&quot;</span>, <span class="stringliteral">&quot;baz:1&quot;</span></div>
<div class="line"> });</div>
<div class="line">}</div>
</div><!-- fragment --> </div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
Synopsis of associated functions</h2></td></tr>
<tr class="memitem:a409d52de54cc7e55eca1a7b5dda4ce30"><td class="memItemLeft" align="right" valign="top">template&lt;&gt; </td></tr>
<tr class="memitem:a409d52de54cc7e55eca1a7b5dda4ce30"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a409d52de54cc7e55eca1a7b5dda4ce30">make&lt; map_tag &gt;</a></td></tr>
<tr class="memdesc:a409d52de54cc7e55eca1a7b5dda4ce30"><td class="mdescLeft">&#160;</td><td class="mdescRight">Function object for creating a <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a></code>. <a href="structboost_1_1hana_1_1map.html#a409d52de54cc7e55eca1a7b5dda4ce30">More...</a><br /></td></tr>
<tr class="separator:a409d52de54cc7e55eca1a7b5dda4ce30"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae73cf43ee56352e4c25984b0fe3c3d04"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#ae73cf43ee56352e4c25984b0fe3c3d04">make_map</a> = <a class="el" href="group__group-core.html#ga1d92480f0af1029878e773dafa3e2f60">make</a>&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html">map_tag</a>&gt;</td></tr>
<tr class="memdesc:ae73cf43ee56352e4c25984b0fe3c3d04"><td class="mdescLeft">&#160;</td><td class="mdescRight">Alias to <code>make&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">map_tag</a>&gt;</code>; provided for convenience. <a href="structboost_1_1hana_1_1map.html#ae73cf43ee56352e4c25984b0fe3c3d04">More...</a><br /></td></tr>
<tr class="separator:ae73cf43ee56352e4c25984b0fe3c3d04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4feb32bd0a065a0732908716d4855b57"><td class="memItemLeft" align="right" valign="top"><a id="a4feb32bd0a065a0732908716d4855b57"></a>
constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a4feb32bd0a065a0732908716d4855b57">to_map</a> = <a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e">to</a>&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html">map_tag</a>&gt;</td></tr>
<tr class="memdesc:a4feb32bd0a065a0732908716d4855b57"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code>to&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">map_tag</a>&gt;</code>; provided for convenience. <br /></td></tr>
<tr class="separator:a4feb32bd0a065a0732908716d4855b57"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f32260f859b2510dd16235b7bc011ac"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a0f32260f859b2510dd16235b7bc011ac">keys</a></td></tr>
<tr class="memdesc:a0f32260f859b2510dd16235b7bc011ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a <code>Sequence</code> of the keys of the map, in unspecified order. <a href="structboost_1_1hana_1_1map.html#a0f32260f859b2510dd16235b7bc011ac">More...</a><br /></td></tr>
<tr class="separator:a0f32260f859b2510dd16235b7bc011ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2e016a68e3ec6eb25868fadb7ce80132"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a2e016a68e3ec6eb25868fadb7ce80132">values</a></td></tr>
<tr class="memdesc:a2e016a68e3ec6eb25868fadb7ce80132"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a <code>Sequence</code> of the values of the map, in unspecified order. <a href="structboost_1_1hana_1_1map.html#a2e016a68e3ec6eb25868fadb7ce80132">More...</a><br /></td></tr>
<tr class="separator:a2e016a68e3ec6eb25868fadb7ce80132"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5791e6dc0e27d8e3a113e4d94482550f"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a5791e6dc0e27d8e3a113e4d94482550f">insert</a></td></tr>
<tr class="memdesc:a5791e6dc0e27d8e3a113e4d94482550f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inserts a new key/value pair in a map. <a href="structboost_1_1hana_1_1map.html#a5791e6dc0e27d8e3a113e4d94482550f">More...</a><br /></td></tr>
<tr class="separator:a5791e6dc0e27d8e3a113e4d94482550f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af856f7bf77f69cdf1b8fd4e566eaef9b"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#af856f7bf77f69cdf1b8fd4e566eaef9b">erase_key</a></td></tr>
<tr class="memdesc:af856f7bf77f69cdf1b8fd4e566eaef9b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes a key/value pair from a map. <a href="structboost_1_1hana_1_1map.html#af856f7bf77f69cdf1b8fd4e566eaef9b">More...</a><br /></td></tr>
<tr class="separator:af856f7bf77f69cdf1b8fd4e566eaef9b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd511f2c01f38405bfba0b6d5b2922e8"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#acd511f2c01f38405bfba0b6d5b2922e8">union_</a></td></tr>
<tr class="memdesc:acd511f2c01f38405bfba0b6d5b2922e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the union of two maps. <a href="structboost_1_1hana_1_1map.html#acd511f2c01f38405bfba0b6d5b2922e8">More...</a><br /></td></tr>
<tr class="separator:acd511f2c01f38405bfba0b6d5b2922e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b3430482d4e88052e621f63a234f3eb"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a3b3430482d4e88052e621f63a234f3eb">intersection</a></td></tr>
<tr class="memdesc:a3b3430482d4e88052e621f63a234f3eb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the intersection of two maps. <a href="structboost_1_1hana_1_1map.html#a3b3430482d4e88052e621f63a234f3eb">More...</a><br /></td></tr>
<tr class="separator:a3b3430482d4e88052e621f63a234f3eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a718ddfe86437adbbca1e1a5db651d139"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a718ddfe86437adbbca1e1a5db651d139">difference</a></td></tr>
<tr class="memdesc:a718ddfe86437adbbca1e1a5db651d139"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the difference of two maps. <a href="structboost_1_1hana_1_1map.html#a718ddfe86437adbbca1e1a5db651d139">More...</a><br /></td></tr>
<tr class="separator:a718ddfe86437adbbca1e1a5db651d139"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8bcb2455eb9f7074185d8fb61a99801e"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a8bcb2455eb9f7074185d8fb61a99801e">symmetric_difference</a></td></tr>
<tr class="memdesc:a8bcb2455eb9f7074185d8fb61a99801e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the symmetric set-theoretic difference of two maps. <a href="structboost_1_1hana_1_1map.html#a8bcb2455eb9f7074185d8fb61a99801e">More...</a><br /></td></tr>
<tr class="separator:a8bcb2455eb9f7074185d8fb61a99801e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
Friends</h2></td></tr>
<tr class="memitem:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="memTemplParams" colspan="2"><a id="a22bef1b2c14cf393a3a9cb1924d8c8ff"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a22bef1b2c14cf393a3a9cb1924d8c8ff">operator==</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_comparable.html#gacaf1ebea6b3ab96ac9dcb82f0e64e547" title="Returns a Logical representing whether x is equal to y.">hana::equal</a></code> <br /></td></tr>
<tr class="separator:a22bef1b2c14cf393a3a9cb1924d8c8ff"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="memTemplParams" colspan="2"><a id="a4ecea0deb4c00ae2eb0b0713ee0645e9"></a>
template&lt;typename X , typename Y &gt; </td></tr>
<tr class="memitem:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="memTemplItemLeft" align="right" valign="top">constexpr friend auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a4ecea0deb4c00ae2eb0b0713ee0645e9">operator!=</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
<tr class="memdesc:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_comparable.html#gae33be2e0d5e04f19082f4b7740dfc9cd" title="Returns a Logical representing whether x is not equal to y.">hana::not_equal</a></code> <br /></td></tr>
<tr class="separator:a4ecea0deb4c00ae2eb0b0713ee0645e9"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a1ee432be0bd10f08a637a437e311e4e2"><td class="memItemLeft" align="right" valign="top"><a id="a1ee432be0bd10f08a637a437e311e4e2"></a>
constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a> ()=default</td></tr>
<tr class="memdesc:a1ee432be0bd10f08a637a437e311e4e2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Default-construct a map. This constructor only exists when all the elements of the map are default-constructible. <br /></td></tr>
<tr class="separator:a1ee432be0bd10f08a637a437e311e4e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a943219d1c9692938167639d8ad2525b8"><td class="memItemLeft" align="right" valign="top"><a id="a943219d1c9692938167639d8ad2525b8"></a>
constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a943219d1c9692938167639d8ad2525b8">map</a> (<a class="el" href="structboost_1_1hana_1_1map.html">map</a> const &amp;other)=default</td></tr>
<tr class="memdesc:a943219d1c9692938167639d8ad2525b8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy-construct a map from another map. This constructor only exists when all the elements of the map are copy-constructible. <br /></td></tr>
<tr class="separator:a943219d1c9692938167639d8ad2525b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a675bb30af155b40f72cbe8607eefbe4e"><td class="memItemLeft" align="right" valign="top"><a id="a675bb30af155b40f72cbe8607eefbe4e"></a>
constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a675bb30af155b40f72cbe8607eefbe4e">map</a> (<a class="el" href="structboost_1_1hana_1_1map.html">map</a> &amp;&amp;other)=default</td></tr>
<tr class="memdesc:a675bb30af155b40f72cbe8607eefbe4e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move-construct a map from another map. This constructor only exists when all the elements of the map are move-constructible. <br /></td></tr>
<tr class="separator:a675bb30af155b40f72cbe8607eefbe4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4a4f472e036abf9bcbda81e831f46e32"><td class="memTemplParams" colspan="2"><a id="a4a4f472e036abf9bcbda81e831f46e32"></a>
template&lt;typename ... P&gt; </td></tr>
<tr class="memitem:a4a4f472e036abf9bcbda81e831f46e32"><td class="memTemplItemLeft" align="right" valign="top">constexpr&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a4a4f472e036abf9bcbda81e831f46e32">map</a> (P &amp;&amp;...pairs)</td></tr>
<tr class="memdesc:a4a4f472e036abf9bcbda81e831f46e32"><td class="mdescLeft">&#160;</td><td class="mdescRight">Construct the map from the provided pairs. <code>P...</code> must be pairs of the same type (modulo ref and cv-qualifiers), and in the same order, as those appearing in <code>Pairs...</code>. The pairs provided to this constructor are emplaced into the map's storage using perfect forwarding. <br /></td></tr>
<tr class="separator:a4a4f472e036abf9bcbda81e831f46e32"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae18123925b628b5cfcb1adaef5c83ac7"><td class="memItemLeft" align="right" valign="top"><a id="ae18123925b628b5cfcb1adaef5c83ac7"></a>
constexpr <a class="el" href="structboost_1_1hana_1_1map.html">map</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#ae18123925b628b5cfcb1adaef5c83ac7">operator=</a> (<a class="el" href="structboost_1_1hana_1_1map.html">map</a> const &amp;other)</td></tr>
<tr class="memdesc:ae18123925b628b5cfcb1adaef5c83ac7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Assign a map to another map <b>with the exact same type</b>. Only exists when all the elements of the map are copy-assignable. <br /></td></tr>
<tr class="separator:ae18123925b628b5cfcb1adaef5c83ac7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9a6635ea36edc582518d278238defa0d"><td class="memItemLeft" align="right" valign="top"><a id="a9a6635ea36edc582518d278238defa0d"></a>
constexpr <a class="el" href="structboost_1_1hana_1_1map.html">map</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a9a6635ea36edc582518d278238defa0d">operator=</a> (<a class="el" href="structboost_1_1hana_1_1map.html">map</a> &amp;&amp;other)</td></tr>
<tr class="memdesc:a9a6635ea36edc582518d278238defa0d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Move-assign a map to another map <b>with the exact same type</b>. Only exists when all the elements of the map are move-assignable. <br /></td></tr>
<tr class="separator:a9a6635ea36edc582518d278238defa0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1532587d8da252c580d24c5f4ab66cca"><td class="memTemplParams" colspan="2"><a id="a1532587d8da252c580d24c5f4ab66cca"></a>
template&lt;typename Key &gt; </td></tr>
<tr class="memitem:a1532587d8da252c580d24c5f4ab66cca"><td class="memTemplItemLeft" align="right" valign="top">constexpr decltype(auto)&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a1532587d8da252c580d24c5f4ab66cca">operator[]</a> (Key &amp;&amp;key)</td></tr>
<tr class="memdesc:a1532587d8da252c580d24c5f4ab66cca"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-_searchable.html#ga3c1826aee6c6eb577810bb99c5c3e53d" title="Returns the value associated to the given key in a structure, or fail.">hana::at_key</a></code> <br /></td></tr>
<tr class="separator:a1532587d8da252c580d24c5f4ab66cca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Associated functions</h2>
<a id="a409d52de54cc7e55eca1a7b5dda4ce30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a409d52de54cc7e55eca1a7b5dda4ce30">&#9670;&nbsp;</a></span>make&lt; map_tag &gt;</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<div class="memtemplate">
template&lt;&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto <a class="el" href="group__group-core.html#ga1d92480f0af1029878e773dafa3e2f60">make</a>&lt; <a class="el" href="structboost_1_1hana_1_1map__tag.html">map_tag</a> &gt;</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; ...pairs) {</div>
<div class="line"> <span class="keywordflow">return</span> map&lt;implementation_defined&gt;{forwarded(pairs)...};</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Function object for creating a <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a></code>. </p>
<p>Given zero or more <code>Product</code>s representing key/value associations, <code>make&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">map_tag</a>&gt;</code> returns a <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a></code> associating these keys to these values.</p>
<p><code>make&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">map_tag</a>&gt;</code> requires all the keys to be unique and to have different hashes. If you need to create a map with duplicate keys or with keys whose hashes might collide, use <code>hana::to_map</code> or insert <code>(key, value)</code> pairs to an empty map successively. However, be aware that doing so will be much more compile-time intensive than using <code>make&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">map_tag</a>&gt;</code>, because the uniqueness of keys will have to be enforced.</p>
<h2><a class="anchor" id="autotoc_md272"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2make_8hpp.html">boost/hana/core/make.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> )</div>
<div class="line"> ==</div>
<div class="line"> hana::make&lt;hana::map_tag&gt;(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a id="ae73cf43ee56352e4c25984b0fe3c3d04"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae73cf43ee56352e4c25984b0fe3c3d04">&#9670;&nbsp;</a></span>make_map</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto make_map = <a class="el" href="group__group-core.html#ga1d92480f0af1029878e773dafa3e2f60">make</a>&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html">map_tag</a>&gt;</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Alias to <code>make&lt;<a class="el" href="structboost_1_1hana_1_1map__tag.html" title="Tag representing hana::maps.">map_tag</a>&gt;</code>; provided for convenience. </p>
<h2><a class="anchor" id="autotoc_md273"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2make_8hpp.html">boost/hana/core/make.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> )</div>
<div class="line"> ==</div>
<div class="line"> hana::make&lt;hana::map_tag&gt;(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a0f32260f859b2510dd16235b7bc011ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0f32260f859b2510dd16235b7bc011ac">&#9670;&nbsp;</a></span>keys</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto keys</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; <a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>) {</div>
<div class="line"> <span class="keywordflow">return</span> implementation_defined;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Returns a <code>Sequence</code> of the keys of the map, in unspecified order. </p>
<h2><a class="anchor" id="autotoc_md274"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="contains_8hpp.html">boost/hana/contains.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="keys_8hpp.html">boost/hana/keys.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="permutations_8hpp.html">boost/hana/permutations.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="tuple_8hpp.html">boost/hana/tuple.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="keyword">auto</span> m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// The order of the keys is unspecified.</span></div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(</div>
<div class="line"> <a class="code" href="group__group-_struct.html#gaf8c7199742581e6e66c8397def68e2d3">hana::keys</a>(m) ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">hana::in</a>^ <a class="code" href="group__group-_sequence.html#gac1e182ac088f1990edd739424d30ea07">hana::permutations</a>(hana::make_tuple(hana::int_c&lt;1&gt;, hana::type_c&lt;void&gt;))</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a2e016a68e3ec6eb25868fadb7ce80132"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e016a68e3ec6eb25868fadb7ce80132">&#9670;&nbsp;</a></span>values</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto values</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; <a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>) -&gt; decltype(<span class="keyword">auto</span>) {</div>
<div class="line"> <span class="keywordflow">return</span> implementation_defined;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Returns a <code>Sequence</code> of the values of the map, in unspecified order. </p>
<h2><a class="anchor" id="autotoc_md275"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="contains_8hpp.html">boost/hana/contains.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="permutations_8hpp.html">boost/hana/permutations.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="tuple_8hpp.html">boost/hana/tuple.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="keyword">auto</span> m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::int_c&lt;1&gt;, <span class="stringliteral">&quot;foobar&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <span class="comment">// The order of the values is unspecified.</span></div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::values(m) ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">hana::in</a>^ <a class="code" href="group__group-_sequence.html#gac1e182ac088f1990edd739424d30ea07">hana::permutations</a>(hana::make_tuple(<span class="stringliteral">&quot;foobar&quot;</span>s, 1234))</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a id="a5791e6dc0e27d8e3a113e4d94482550f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5791e6dc0e27d8e3a113e4d94482550f">&#9670;&nbsp;</a></span>insert</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto insert</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; <a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>, <span class="keyword">auto</span>&amp;&amp; pair) {</div>
<div class="line"> <span class="keywordflow">return</span> tag-dispatched;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Inserts a new key/value pair in a map. </p>
<p>Given a <code>(key, value)</code> pair, <code>insert</code> inserts this new pair into a map. If the map already contains this key, nothing is done and the map is returned as-is.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">map</td><td>The map in which to insert a <code>(key,value)</code> pair.</td></tr>
<tr><td class="paramname">pair</td><td>An arbitrary <code>Product</code> representing a <code>(key, value)</code> pair to insert in the map. The <code>key</code> must be compile-time <code>Comparable</code>.</td></tr>
</table>
</dd>
</dl>
<h2><a class="anchor" id="autotoc_md276"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="insert_8hpp.html">boost/hana/insert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="keyword">auto</span> m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="stringliteral">&quot;abcd&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> <a class="code" href="group__group-_sequence.html#gae22a1a184b1b2dd550fa4fa619bed2e9">hana::insert</a>(m, hana::make_pair(hana::type_c&lt;float&gt;, <span class="charliteral">&#39;x&#39;</span>)) ==</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="stringliteral">&quot;abcd&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, <span class="charliteral">&#39;x&#39;</span>)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(<a class="code" href="group__group-_sequence.html#gae22a1a184b1b2dd550fa4fa619bed2e9">hana::insert</a>(m, hana::make_pair(hana::type_c&lt;void&gt;, <span class="charliteral">&#39;x&#39;</span>)) == m);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a id="af856f7bf77f69cdf1b8fd4e566eaef9b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af856f7bf77f69cdf1b8fd4e566eaef9b">&#9670;&nbsp;</a></span>erase_key</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto erase_key</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; <a class="code" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a>, <span class="keyword">auto</span>&amp;&amp; key) {</div>
<div class="line"> <span class="keywordflow">return</span> tag-dispatched;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Removes a key/value pair from a map. </p>
<p>Returns a new <code><a class="el" href="structboost_1_1hana_1_1map.html" title="Basic associative container requiring unique, Comparable and Hashable keys.">hana::map</a></code> containing all the elements of the original, except for the <code>(key, value)</code> pair whose <code>key</code> compares <code>equal</code> to the given key. If the map does not contain such an element, a new map equal to the original is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">map</td><td>The map in which to erase a <code>key</code>.</td></tr>
<tr><td class="paramname">key</td><td>A key to remove from the map. It must be compile-time <code>Comparable</code>.</td></tr>
</table>
</dd>
</dl>
<h2><a class="anchor" id="autotoc_md277"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="erase__key_8hpp.html">boost/hana/erase_key.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="pair_8hpp.html">boost/hana/pair.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="string_8hpp.html">boost/hana/string.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>std::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <span class="keyword">auto</span> m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="stringliteral">&quot;abcd&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;foobar!&quot;</span>), hana::type_c&lt;char&gt;)</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::erase_key(m, BOOST_HANA_STRING(<span class="stringliteral">&quot;foobar!&quot;</span>)) ==</div>
<div class="line"> hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, <span class="stringliteral">&quot;abcd&quot;</span>s),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;void&gt;, 1234)</div>
<div class="line"> )</div>
<div class="line"> );</div>
<div class="line"> </div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(hana::erase_key(m, hana::type_c&lt;char&gt;) == m);</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
<a id="acd511f2c01f38405bfba0b6d5b2922e8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acd511f2c01f38405bfba0b6d5b2922e8">&#9670;&nbsp;</a></span>union_</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto union_</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; xs, <span class="keyword">auto</span>&amp;&amp; ys) {</div>
<div class="line"> <span class="keywordflow">return</span> tag-dispatched;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Returns the union of two maps. </p>
<p>Given two maps <code>xs</code> and <code>ys</code>, <code>hana::union_(xs, ys)</code> is a new map containing all the elements of <code>xs</code> and all the elements of <code>ys</code>, without duplicates. If both <code>xs</code> and <code>ys</code> contain an element with the same <code>key</code>, the one in <code>ys</code> is taken. Functionally, <code>hana::union_(xs, ys)</code> is equivalent to </p><div class="fragment"><div class="line">hana::fold_left(xs, ys, <a class="code" href="group__group-_sequence.html#gae22a1a184b1b2dd550fa4fa619bed2e9">hana::insert</a>)</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">xs,ys</td><td>The two maps to compute the union of.</td></tr>
</table>
</dd>
</dl>
<h2><a class="anchor" id="autotoc_md278"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="equal_8hpp.html">boost/hana/equal.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="string_8hpp.html">boost/hana/string.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="type_8hpp.html">boost/hana/type.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="union_8hpp.html">boost/hana/union.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>hana::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m1 = hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key1&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key2&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m2 = hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key3&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key4&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key5&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::union_(m1, m2) == hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key1&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key2&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key3&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key4&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key5&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">));</div>
<div class="line"> </div>
<div class="line">constexpr <span class="keyword">auto</span> m3 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, hana::int_c&lt;1&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;true&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line">constexpr <span class="keyword">auto</span> m4 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;char&gt;, hana::char_c&lt;&#39;c&#39;&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;false&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::union_(m3, m4) == hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, hana::int_c&lt;1&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;false&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;char&gt;, hana::char_c&lt;&#39;c&#39;&gt;)</div>
<div class="line">));</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() { }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a3b3430482d4e88052e621f63a234f3eb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b3430482d4e88052e621f63a234f3eb">&#9670;&nbsp;</a></span>intersection</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto intersection</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; xs, <span class="keyword">auto</span>&amp;&amp; ys) {</div>
<div class="line"> <span class="keywordflow">return</span> tag-dispatched;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Returns the intersection of two maps. </p>
<p>Given two maps <code>xs</code> and <code>ys</code>, <code>intersection(xs, ys)</code> is a new map containing exactly those (key, value) pairs from xs, for which key is present in <code>ys</code>. In other words, the following holds for any object <code>pair(k, v)</code>: </p><div class="fragment"><div class="line">pair(k, v) ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">in</a>^ <a class="code" href="structboost_1_1hana_1_1map.html#a3b3430482d4e88052e621f63a234f3eb">intersection</a>(xs, ys) <span class="keywordflow">if</span> and only <span class="keywordflow">if</span> (k, v) ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">in</a>^ xs &amp;&amp; k ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">in</a>^ <a class="code" href="structboost_1_1hana_1_1map.html#a0f32260f859b2510dd16235b7bc011ac">keys</a>(ys)</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>This function is not commutative, i.e. <code>intersection(xs, ys)</code> is not necessarily the same as <code>intersection(ys, xs)</code>. Indeed, the set of keys in <code>intersection(xs, ys)</code> is always the same as the set of keys in <code>intersection(ys, xs)</code>, but the value associated to each key may be different. <code>intersection(xs, ys)</code> contains values present in <code>xs</code>, and <code>intersection(ys, xs)</code> contains values present in <code>ys</code>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">xs,ys</td><td>Two maps to intersect.</td></tr>
</table>
</dd>
</dl>
<h2><a class="anchor" id="autotoc_md279"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="equal_8hpp.html">boost/hana/equal.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="intersection_8hpp.html">boost/hana/intersection.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="string_8hpp.html">boost/hana/string.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>hana::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m1 = hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key1&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key2&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m2 = hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key3&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key4&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key5&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::intersection(m1, m2) == hana::make_map());</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m3 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, hana::int_c&lt;1&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;true&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;std::string&gt;, BOOST_HANA_STRING(<span class="stringliteral">&quot;hana&quot;</span>)),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, hana::int_c&lt;100&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m4 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;char&gt;, hana::char_c&lt;&#39;c&#39;&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;false&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;std::string&gt;, BOOST_HANA_STRING(<span class="stringliteral">&quot;boost&quot;</span>))</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::intersection(m3, m4) == hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;true&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;std::string&gt;, BOOST_HANA_STRING(<span class="stringliteral">&quot;hana&quot;</span>))</div>
<div class="line">));</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() { }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a718ddfe86437adbbca1e1a5db651d139"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a718ddfe86437adbbca1e1a5db651d139">&#9670;&nbsp;</a></span>difference</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto difference</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; xs, <span class="keyword">auto</span>&amp;&amp; ys) {</div>
<div class="line"> <span class="keywordflow">return</span> tag-dispatched;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Returns the difference of two maps. </p>
<p>Given two maps <code>xs</code> and <code>ys</code>, <code>difference(xs, ys)</code> is a new map containing exactly those (key, value) pairs from xs, for which key is not present in <code>keys(ys)</code>. In other words, the following holds for any object <code>pair(k, v)</code>: </p><div class="fragment"><div class="line">pair(k, v) ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">in</a>^ <a class="code" href="structboost_1_1hana_1_1map.html#a718ddfe86437adbbca1e1a5db651d139">difference</a>(xs, ys) <span class="keywordflow">if</span> and only <span class="keywordflow">if</span> (k, v) ^<a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">in</a>^ xs &amp;&amp; k ^not <a class="code" href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">in</a>^ <a class="code" href="structboost_1_1hana_1_1map.html#a0f32260f859b2510dd16235b7bc011ac">keys</a>(ys)</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>This function is not commutative, i.e. <code>difference(xs, ys)</code> is not necessarily the same as <code>difference(ys, xs)</code>. Indeed, consider the case where <code>xs</code> is empty and <code>ys</code> isn't. In that case, <code>difference(xs, ys)</code> is empty, but <code>difference(ys, xs)</code> is equal to <code>ys</code>. For symmetric version of this operation, see <code>symmetric_difference</code>.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">xs,ys</td><td>Two maps to compute the difference of.</td></tr>
</table>
</dd>
</dl>
<h2><a class="anchor" id="autotoc_md280"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="equal_8hpp.html">boost/hana/equal.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="intersection_8hpp.html">boost/hana/intersection.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="string_8hpp.html">boost/hana/string.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;string&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"><span class="keyword">using namespace </span>hana::literals;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m1 = hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key1&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key2&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m2 = hana::make_map(</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key3&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key4&quot;</span>), hana::type_c&lt;std::string&gt;),</div>
<div class="line"> hana::make_pair(BOOST_HANA_STRING(<span class="stringliteral">&quot;key5&quot;</span>), hana::type_c&lt;std::string&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::intersection(m1, m2) == hana::make_map());</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m3 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, hana::int_c&lt;1&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;true&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;std::string&gt;, BOOST_HANA_STRING(<span class="stringliteral">&quot;hana&quot;</span>)),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, hana::int_c&lt;100&gt;)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><span class="keyword">static</span> <span class="keyword">auto</span> m4 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;char&gt;, hana::char_c&lt;&#39;c&#39;&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;false&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;std::string&gt;, BOOST_HANA_STRING(<span class="stringliteral">&quot;boost&quot;</span>))</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::intersection(m3, m4) == hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::bool_c&lt;true&gt;),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;std::string&gt;, BOOST_HANA_STRING(<span class="stringliteral">&quot;hana&quot;</span>))</div>
<div class="line">));</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() { }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a8bcb2455eb9f7074185d8fb61a99801e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8bcb2455eb9f7074185d8fb61a99801e">&#9670;&nbsp;</a></span>symmetric_difference</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename ... Pairs&gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">constexpr auto symmetric_difference</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">related</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&amp;&amp; xs, <span class="keyword">auto</span>&amp;&amp; ys) {</div>
<div class="line"> <span class="keywordflow">return</span> tag-dispatched;</div>
<div class="line"> }</div>
</div><!-- fragment -->
<p>Returns the symmetric set-theoretic difference of two maps. </p>
<p>Given two sets <code>xs</code> and <code>ys</code>, <code>symmetric_difference(xs, ys)</code> is a new map containing all the elements of <code>xs</code> whose keys are not contained in <code>keys(ys)</code>, and all the elements of <code>ys</code> whose keys are not contained in <code>keys(xs)</code>. The symmetric difference of two maps satisfies the following: </p><div class="fragment"><div class="line"><a class="code" href="structboost_1_1hana_1_1map.html#a8bcb2455eb9f7074185d8fb61a99801e">symmetric_difference</a>(xs, ys) == <a class="code" href="structboost_1_1hana_1_1map.html#acd511f2c01f38405bfba0b6d5b2922e8">union_</a>(<a class="code" href="structboost_1_1hana_1_1map.html#a718ddfe86437adbbca1e1a5db651d139">difference</a>(xs, ys), <a class="code" href="structboost_1_1hana_1_1map.html#a718ddfe86437adbbca1e1a5db651d139">difference</a>(ys, xs))</div>
</div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">xs,ys</td><td>Two maps to compute the symmetric difference of.</td></tr>
</table>
</dd>
</dl>
<h2><a class="anchor" id="autotoc_md281"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="map_8hpp.html">boost/hana/map.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="symmetric__difference_8hpp.html">boost/hana/symmetric_difference.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line">constexpr <span class="keyword">auto</span> m1 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, 1),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::true_c)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line">constexpr <span class="keyword">auto</span> m2 = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, 1.0),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;long long&gt;, 2LL),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;int&gt;, 3)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line">constexpr <span class="keyword">auto</span> result_m = hana::make_map(</div>
<div class="line"> hana::make_pair(hana::type_c&lt;bool&gt;, hana::true_c),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;float&gt;, 1.0),</div>
<div class="line"> hana::make_pair(hana::type_c&lt;long long&gt;, 2LL)</div>
<div class="line">);</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line"> <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line"> hana::symmetric_difference(m1, m2) == result_m</div>
<div class="line"> );</div>
<div class="line">}</div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div class="ttc" id="aequal_8hpp_html"><div class="ttname"><a href="equal_8hpp.html">equal.hpp</a></div><div class="ttdoc">Defines boost::hana::equal.</div></div>
<div class="ttc" id="astructboost_1_1hana_1_1map_html_a718ddfe86437adbbca1e1a5db651d139"><div class="ttname"><a href="structboost_1_1hana_1_1map.html#a718ddfe86437adbbca1e1a5db651d139">boost::hana::map::difference</a></div><div class="ttdeci">constexpr auto difference</div><div class="ttdoc">Returns the difference of two maps.</div><div class="ttdef"><b>Definition:</b> map.hpp:349</div></div>
<div class="ttc" id="agroup__group-assertions_html_ga2c5006540936d9f8880e3a39f4fcc035"><div class="ttname"><a href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a></div><div class="ttdeci">#define BOOST_HANA_CONSTANT_CHECK(...)</div><div class="ttdoc">Equivalent to BOOST_HANA_CONSTANT_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTI...</div><div class="ttdef"><b>Definition:</b> assert.hpp:239</div></div>
<div class="ttc" id="atuple_8hpp_html"><div class="ttname"><a href="tuple_8hpp.html">tuple.hpp</a></div><div class="ttdoc">Defines boost::hana::tuple.</div></div>
<div class="ttc" id="agroup__group-_product_html_ga7bb979d59ffc3ab862cb7d9dc7730077"><div class="ttname"><a href="group__group-_product.html#ga7bb979d59ffc3ab862cb7d9dc7730077">boost::hana::second</a></div><div class="ttdeci">constexpr auto second</div><div class="ttdoc">Returns the second element of a pair.</div><div class="ttdef"><b>Definition:</b> second.hpp:32</div></div>
<div class="ttc" id="aintegral__constant_8hpp_html"><div class="ttname"><a href="integral__constant_8hpp.html">integral_constant.hpp</a></div><div class="ttdoc">Defines boost::hana::integral_constant.</div></div>
<div class="ttc" id="acore_2make_8hpp_html"><div class="ttname"><a href="core_2make_8hpp.html">make.hpp</a></div><div class="ttdoc">Defines boost::hana::make.</div></div>
<div class="ttc" id="agroup__group-_searchable_html_ga6b6cdd69942b0fe3bf5254247f9c861e"><div class="ttname"><a href="group__group-_searchable.html#ga6b6cdd69942b0fe3bf5254247f9c861e">boost::hana::find</a></div><div class="ttdeci">constexpr auto find</div><div class="ttdoc">Finds the value associated to the given key in a structure.</div><div class="ttdef"><b>Definition:</b> find.hpp:44</div></div>
<div class="ttc" id="amap_8hpp_html"><div class="ttname"><a href="map_8hpp.html">map.hpp</a></div><div class="ttdoc">Defines boost::hana::map.</div></div>
<div class="ttc" id="afind_8hpp_html"><div class="ttname"><a href="find_8hpp.html">find.hpp</a></div><div class="ttdoc">Defines boost::hana::find.</div></div>
<div class="ttc" id="agroup__group-_sequence_html_gae22a1a184b1b2dd550fa4fa619bed2e9"><div class="ttname"><a href="group__group-_sequence.html#gae22a1a184b1b2dd550fa4fa619bed2e9">boost::hana::insert</a></div><div class="ttdeci">constexpr insert_t insert</div><div class="ttdoc">Insert a value at a given index in a sequence.</div><div class="ttdef"><b>Definition:</b> insert.hpp:29</div></div>
<div class="ttc" id="astructboost_1_1hana_1_1map_html_acd511f2c01f38405bfba0b6d5b2922e8"><div class="ttname"><a href="structboost_1_1hana_1_1map.html#acd511f2c01f38405bfba0b6d5b2922e8">boost::hana::map::union_</a></div><div class="ttdeci">constexpr auto union_</div><div class="ttdoc">Returns the union of two maps.</div><div class="ttdef"><b>Definition:</b> map.hpp:281</div></div>
<div class="ttc" id="agroup__group-functional_html_ga35c4fc3c5677b9f558150b90e74d3ab1"><div class="ttname"><a href="group__group-functional.html#ga35c4fc3c5677b9f558150b90e74d3ab1">boost::hana::on</a></div><div class="ttdeci">constexpr auto on</div><div class="ttdoc">Invoke a function with the result of invoking another function on each argument.</div><div class="ttdef"><b>Definition:</b> on.hpp:54</div></div>
<div class="ttc" id="apermutations_8hpp_html"><div class="ttname"><a href="permutations_8hpp.html">permutations.hpp</a></div><div class="ttdoc">Defines boost::hana::permutations.</div></div>
<div class="ttc" id="astring_8hpp_html"><div class="ttname"><a href="string_8hpp.html">string.hpp</a></div><div class="ttdoc">Defines boost::hana::string.</div></div>
<div class="ttc" id="astructboost_1_1hana_1_1map_html_a0f32260f859b2510dd16235b7bc011ac"><div class="ttname"><a href="structboost_1_1hana_1_1map.html#a0f32260f859b2510dd16235b7bc011ac">boost::hana::map::keys</a></div><div class="ttdeci">constexpr auto keys</div><div class="ttdoc">Returns a Sequence of the keys of the map, in unspecified order.</div><div class="ttdef"><b>Definition:</b> map.hpp:186</div></div>
<div class="ttc" id="aerase__key_8hpp_html"><div class="ttname"><a href="erase__key_8hpp.html">erase_key.hpp</a></div><div class="ttdoc">Defines boost::hana::erase_key.</div></div>
<div class="ttc" id="acontains_8hpp_html"><div class="ttname"><a href="contains_8hpp.html">contains.hpp</a></div><div class="ttdoc">Defines boost::hana::contains and boost::hana::in.</div></div>
<div class="ttc" id="aintersection_8hpp_html"><div class="ttname"><a href="intersection_8hpp.html">intersection.hpp</a></div><div class="ttdoc">Defines boost::hana::intersection.</div></div>
<div class="ttc" id="atype_8hpp_html"><div class="ttname"><a href="type_8hpp.html">type.hpp</a></div><div class="ttdoc">Defines boost::hana::type and related utilities.</div></div>
<div class="ttc" id="anamespaceboost_1_1hana_html"><div class="ttname"><a href="namespaceboost_1_1hana.html">boost::hana</a></div><div class="ttdoc">Namespace containing everything in the library.</div><div class="ttdef"><b>Definition:</b> accessors.hpp:20</div></div>
<div class="ttc" id="afirst_8hpp_html"><div class="ttname"><a href="first_8hpp.html">first.hpp</a></div><div class="ttdoc">Defines boost::hana::first.</div></div>
<div class="ttc" id="agroup__group-_searchable_html_ga0d9456ceda38b6ca664998e79d7c45b7"><div class="ttname"><a href="group__group-_searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">boost::hana::in</a></div><div class="ttdeci">constexpr auto in</div><div class="ttdoc">Return whether the key occurs in the structure.</div><div class="ttdef"><b>Definition:</b> contains.hpp:70</div></div>
<div class="ttc" id="aassert_8hpp_html"><div class="ttname"><a href="assert_8hpp.html">assert.hpp</a></div><div class="ttdoc">Defines macros to perform different kinds of assertions.</div></div>
<div class="ttc" id="afold__left_8hpp_html"><div class="ttname"><a href="fold__left_8hpp.html">fold_left.hpp</a></div><div class="ttdoc">Defines boost::hana::fold_left.</div></div>
<div class="ttc" id="agroup__group-_sequence_html_gac1e182ac088f1990edd739424d30ea07"><div class="ttname"><a href="group__group-_sequence.html#gac1e182ac088f1990edd739424d30ea07">boost::hana::permutations</a></div><div class="ttdeci">constexpr auto permutations</div><div class="ttdoc">Return a sequence of all the permutations of the given sequence.</div><div class="ttdef"><b>Definition:</b> permutations.hpp:34</div></div>
<div class="ttc" id="astructboost_1_1hana_1_1map_html_a1ee432be0bd10f08a637a437e311e4e2"><div class="ttname"><a href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">boost::hana::map::map</a></div><div class="ttdeci">constexpr map()=default</div><div class="ttdoc">Default-construct a map. This constructor only exists when all the elements of the map are default-co...</div></div>
<div class="ttc" id="acore_2to_8hpp_html"><div class="ttname"><a href="core_2to_8hpp.html">to.hpp</a></div><div class="ttdoc">Defines boost::hana::to and related utilities.</div></div>
<div class="ttc" id="akeys_8hpp_html"><div class="ttname"><a href="keys_8hpp.html">keys.hpp</a></div><div class="ttdoc">Defines boost::hana::keys.</div></div>
<div class="ttc" id="agroup__group-assertions_html_ga4796ae107d58b67e0bbccd5ae6f70101"><div class="ttname"><a href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a></div><div class="ttdeci">#define BOOST_HANA_RUNTIME_CHECK(...)</div><div class="ttdoc">Equivalent to BOOST_HANA_RUNTIME_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTIO...</div><div class="ttdef"><b>Definition:</b> assert.hpp:209</div></div>
<div class="ttc" id="asecond_8hpp_html"><div class="ttname"><a href="second_8hpp.html">second.hpp</a></div><div class="ttdoc">Defines boost::hana::second.</div></div>
<div class="ttc" id="asymmetric__difference_8hpp_html"><div class="ttname"><a href="symmetric__difference_8hpp.html">symmetric_difference.hpp</a></div><div class="ttdoc">Defines boost::hana::symmetric_difference.</div></div>
<div class="ttc" id="agroup__group-_searchable_html_ga38e7748956cbc9f3d9bb035ac8577906"><div class="ttname"><a href="group__group-_searchable.html#ga38e7748956cbc9f3d9bb035ac8577906">boost::hana::contains</a></div><div class="ttdeci">constexpr auto contains</div><div class="ttdoc">Returns whether the key occurs in the structure.</div><div class="ttdef"><b>Definition:</b> contains.hpp:42</div></div>
<div class="ttc" id="aat__key_8hpp_html"><div class="ttname"><a href="at__key_8hpp.html">at_key.hpp</a></div><div class="ttdoc">Defines boost::hana::at_key.</div></div>
<div class="ttc" id="agroup__group-_product_html_ga34bbf4281de06dc3540441e8b2bd24f4"><div class="ttname"><a href="group__group-_product.html#ga34bbf4281de06dc3540441e8b2bd24f4">boost::hana::first</a></div><div class="ttdeci">constexpr auto first</div><div class="ttdoc">Returns the first element of a pair.</div><div class="ttdef"><b>Definition:</b> first.hpp:33</div></div>
<div class="ttc" id="ainsert_8hpp_html"><div class="ttname"><a href="insert_8hpp.html">insert.hpp</a></div><div class="ttdoc">Defines boost::hana::insert.</div></div>
<div class="ttc" id="astructboost_1_1hana_1_1map_html_a8bcb2455eb9f7074185d8fb61a99801e"><div class="ttname"><a href="structboost_1_1hana_1_1map.html#a8bcb2455eb9f7074185d8fb61a99801e">boost::hana::map::symmetric_difference</a></div><div class="ttdeci">constexpr auto symmetric_difference</div><div class="ttdoc">Returns the symmetric set-theoretic difference of two maps.</div><div class="ttdef"><b>Definition:</b> map.hpp:374</div></div>
<div class="ttc" id="aunion_8hpp_html"><div class="ttname"><a href="union_8hpp.html">union.hpp</a></div><div class="ttdoc">Defines boost::hana::union.</div></div>
<div class="ttc" id="apair_8hpp_html"><div class="ttname"><a href="pair_8hpp.html">pair.hpp</a></div><div class="ttdoc">Defines boost::hana::pair.</div></div>
<div class="ttc" id="agroup__group-_struct_html_gaf8c7199742581e6e66c8397def68e2d3"><div class="ttname"><a href="group__group-_struct.html#gaf8c7199742581e6e66c8397def68e2d3">boost::hana::keys</a></div><div class="ttdeci">constexpr keys_t keys</div><div class="ttdoc">Returns a Sequence containing the name of the members of the data structure.</div><div class="ttdef"><b>Definition:</b> keys.hpp:29</div></div>
<div class="ttc" id="astructboost_1_1hana_1_1map_html_a3b3430482d4e88052e621f63a234f3eb"><div class="ttname"><a href="structboost_1_1hana_1_1map.html#a3b3430482d4e88052e621f63a234f3eb">boost::hana::map::intersection</a></div><div class="ttdeci">constexpr auto intersection</div><div class="ttdoc">Returns the intersection of two maps.</div><div class="ttdef"><b>Definition:</b> map.hpp:315</div></div>
<div class="ttc" id="aoptional_8hpp_html"><div class="ttname"><a href="optional_8hpp.html">optional.hpp</a></div><div class="ttdoc">Defines boost::hana::optional.</div></div>
<!--
Copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-->
<!-- boost-no-inspect -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><b>boost</b></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana.html">hana</a></li><li class="navelem"><a class="el" href="structboost_1_1hana_1_1map.html">map</a></li>
</ul>
</div>
</body>
</html>