structboost_1_1hana_1_1map.html 97 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. <!--
  2. Copyright Louis Dionne 2013-2017
  3. Distributed under the Boost Software License, Version 1.0.
  4. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  5. -->
  6. <!-- boost-no-inspect -->
  7. <!-- HTML header for doxygen 1.8.9.1-->
  8. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml">
  10. <head>
  11. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  12. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  13. <meta name="generator" content="Doxygen 1.8.15"/>
  14. <title>Boost.Hana: boost::hana::map&lt; Pairs &gt; Struct Template Reference</title>
  15. <link href="tabs.css" rel="stylesheet" type="text/css"/>
  16. <script type="text/javascript" src="jquery.js"></script>
  17. <script type="text/javascript" src="dynsections.js"></script>
  18. <link href="navtree.css" rel="stylesheet" type="text/css"/>
  19. <script type="text/javascript" src="resize.js"></script>
  20. <script type="text/javascript" src="navtreedata.js"></script>
  21. <script type="text/javascript" src="navtree.js"></script>
  22. <script type="text/javascript">
  23. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  24. $(document).ready(initResizable);
  25. /* @license-end */</script>
  26. <link href="search/search.css" rel="stylesheet" type="text/css"/>
  27. <script type="text/javascript" src="search/searchdata.js"></script>
  28. <script type="text/javascript" src="search/search.js"></script>
  29. <script type="text/javascript">
  30. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  31. $(document).ready(function() { init_search(); });
  32. /* @license-end */
  33. </script>
  34. <script type="text/x-mathjax-config">
  35. MathJax.Hub.Config({
  36. extensions: ["tex2jax.js"],
  37. jax: ["input/TeX","output/HTML-CSS"],
  38. });
  39. // Copyright Louis Dionne 2013-2017
  40. // Distributed under the Boost Software License, Version 1.0.
  41. // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  42. MathJax.Hub.Config({
  43. "HTML-CSS": {
  44. linebreaks: {
  45. automatic: true,
  46. width: "75% container"
  47. }
  48. }
  49. });
  50. </script><script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
  51. <link href="doxygen.css" rel="stylesheet" type="text/css" />
  52. <!-- Additional javascript for drawing charts. -->
  53. <script type="text/javascript" src="highcharts.js"></script>
  54. <script type="text/javascript" src="highcharts-data.js"></script>
  55. <script type="text/javascript" src="highcharts-exporting.js"></script>
  56. <script type="text/javascript" src="chart.js"></script>
  57. <script type="text/javascript" src="hana.js"></script>
  58. </head>
  59. <body>
  60. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  61. <div id="titlearea">
  62. <table cellspacing="0" cellpadding="0">
  63. <tbody>
  64. <tr style="height: 56px;">
  65. <td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
  66. <td style="padding-left: 0.5em;">
  67. <div id="projectname">Boost.Hana
  68. &#160;<span id="projectnumber">1.6.0</span>
  69. </div>
  70. <div id="projectbrief">Your standard library for metaprogramming</div>
  71. </td>
  72. <td> <div id="MSearchBox" class="MSearchBoxInactive">
  73. <span class="left">
  74. <img id="MSearchSelect" src="search/mag_sel.png"
  75. onmouseover="return searchBox.OnSearchSelectShow()"
  76. onmouseout="return searchBox.OnSearchSelectHide()"
  77. alt=""/>
  78. <input type="text" id="MSearchField" value="Search" accesskey="S"
  79. onfocus="searchBox.OnSearchFieldFocus(true)"
  80. onblur="searchBox.OnSearchFieldFocus(false)"
  81. onkeyup="searchBox.OnSearchFieldChange(event)"/>
  82. </span><span class="right">
  83. <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
  84. </span>
  85. </div>
  86. </td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. </div>
  91. <!-- end header part -->
  92. <!-- Generated by Doxygen 1.8.15 -->
  93. <script type="text/javascript">
  94. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  95. var searchBox = new SearchBox("searchBox", "search",false,'Search');
  96. /* @license-end */
  97. </script>
  98. </div><!-- top -->
  99. <div id="side-nav" class="ui-resizable side-nav-resizable">
  100. <div id="nav-tree">
  101. <div id="nav-tree-contents">
  102. <div id="nav-sync" class="sync"></div>
  103. </div>
  104. </div>
  105. <div id="splitbar" style="-moz-user-select:none;"
  106. class="ui-resizable-handle">
  107. </div>
  108. </div>
  109. <script type="text/javascript">
  110. /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  111. $(document).ready(function(){initNavTree('structboost_1_1hana_1_1map.html','');});
  112. /* @license-end */
  113. </script>
  114. <div id="doc-content">
  115. <!-- window showing the filter options -->
  116. <div id="MSearchSelectWindow"
  117. onmouseover="return searchBox.OnSearchSelectShow()"
  118. onmouseout="return searchBox.OnSearchSelectHide()"
  119. onkeydown="return searchBox.OnSearchSelectKey(event)">
  120. </div>
  121. <!-- iframe showing the search results (closed by default) -->
  122. <div id="MSearchResultsWindow">
  123. <iframe src="javascript:void(0)" frameborder="0"
  124. name="MSearchResults" id="MSearchResults">
  125. </iframe>
  126. </div>
  127. <div class="header">
  128. <div class="summary">
  129. <a href="#related">Synopsis of associated functions</a> &#124;
  130. <a href="#friends">Friends</a> &#124;
  131. <a href="#pub-methods">Public Member Functions</a> &#124;
  132. <a href="structboost_1_1hana_1_1map-members.html">List of all members</a> </div>
  133. <div class="headertitle">
  134. <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>
  135. </div><!--header-->
  136. <div class="contents">
  137. <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
  138. <div class="textblock"><h3>template&lt;typename ... Pairs&gt;<br />
  139. struct boost::hana::map&lt; Pairs &gt;</h3>
  140. <p>Basic associative container requiring unique, <code>Comparable</code> and <code>Hashable</code> keys. </p>
  141. <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>
  142. <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>
  143. <li>the presence of additional constructors</li>
  144. <li>the presence of additional assignment operators</li>
  145. <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>
  146. </ul>
  147. 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>
  148. <h2>Modeled concepts </h2>
  149. <ol type="1">
  150. <li><code>Comparable</code><br />
  151. 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>
  152. <li><code>Searchable</code><br />
  153. 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>
  154. <li><code>Foldable</code><br />
  155. 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> <a class="code" href="group__group-Foldable.html#ga38c6b3f6b1cbadb9b8432a05ff16b7d2">hana::fold_left</a>(<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>
  156. </ol>
  157. <h2>Conversion from any <code>Foldable</code> </h2>
  158. <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>Example </h2>
  159. <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">
  160. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
  161. Synopsis of associated functions</h2></td></tr>
  162. <tr class="memitem:a409d52de54cc7e55eca1a7b5dda4ce30"><td class="memTemplParams" colspan="2">template&lt;&gt; </td></tr>
  163. <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>
  164. <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="#a409d52de54cc7e55eca1a7b5dda4ce30">More...</a><br /></td></tr>
  165. <tr class="separator:a409d52de54cc7e55eca1a7b5dda4ce30"><td class="memSeparator" colspan="2">&#160;</td></tr>
  166. <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>
  167. <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="#ae73cf43ee56352e4c25984b0fe3c3d04">More...</a><br /></td></tr>
  168. <tr class="separator:ae73cf43ee56352e4c25984b0fe3c3d04"><td class="memSeparator" colspan="2">&#160;</td></tr>
  169. <tr class="memitem:a4feb32bd0a065a0732908716d4855b57"><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#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>
  170. <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. <a href="#a4feb32bd0a065a0732908716d4855b57">More...</a><br /></td></tr>
  171. <tr class="separator:a4feb32bd0a065a0732908716d4855b57"><td class="memSeparator" colspan="2">&#160;</td></tr>
  172. <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>
  173. <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="#a0f32260f859b2510dd16235b7bc011ac">More...</a><br /></td></tr>
  174. <tr class="separator:a0f32260f859b2510dd16235b7bc011ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
  175. <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>
  176. <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="#a2e016a68e3ec6eb25868fadb7ce80132">More...</a><br /></td></tr>
  177. <tr class="separator:a2e016a68e3ec6eb25868fadb7ce80132"><td class="memSeparator" colspan="2">&#160;</td></tr>
  178. <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>
  179. <tr class="memdesc:a5791e6dc0e27d8e3a113e4d94482550f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Inserts a new key/value pair in a map. <a href="#a5791e6dc0e27d8e3a113e4d94482550f">More...</a><br /></td></tr>
  180. <tr class="separator:a5791e6dc0e27d8e3a113e4d94482550f"><td class="memSeparator" colspan="2">&#160;</td></tr>
  181. <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>
  182. <tr class="memdesc:af856f7bf77f69cdf1b8fd4e566eaef9b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Removes a key/value pair from a map. <a href="#af856f7bf77f69cdf1b8fd4e566eaef9b">More...</a><br /></td></tr>
  183. <tr class="separator:af856f7bf77f69cdf1b8fd4e566eaef9b"><td class="memSeparator" colspan="2">&#160;</td></tr>
  184. <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>
  185. <tr class="memdesc:acd511f2c01f38405bfba0b6d5b2922e8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the union of two maps. <a href="#acd511f2c01f38405bfba0b6d5b2922e8">More...</a><br /></td></tr>
  186. <tr class="separator:acd511f2c01f38405bfba0b6d5b2922e8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  187. <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>
  188. <tr class="memdesc:a3b3430482d4e88052e621f63a234f3eb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the intersection of two maps. <a href="#a3b3430482d4e88052e621f63a234f3eb">More...</a><br /></td></tr>
  189. <tr class="separator:a3b3430482d4e88052e621f63a234f3eb"><td class="memSeparator" colspan="2">&#160;</td></tr>
  190. <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>
  191. <tr class="memdesc:a718ddfe86437adbbca1e1a5db651d139"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the difference of two maps. <a href="#a718ddfe86437adbbca1e1a5db651d139">More...</a><br /></td></tr>
  192. <tr class="separator:a718ddfe86437adbbca1e1a5db651d139"><td class="memSeparator" colspan="2">&#160;</td></tr>
  193. <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>
  194. <tr class="memdesc:a8bcb2455eb9f7074185d8fb61a99801e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the symmetric set-theoretic difference of two maps. <a href="#a8bcb2455eb9f7074185d8fb61a99801e">More...</a><br /></td></tr>
  195. <tr class="separator:a8bcb2455eb9f7074185d8fb61a99801e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  196. </table><table class="memberdecls">
  197. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
  198. Friends</h2></td></tr>
  199. <tr class="memitem:a27607958295e6da8a0ba602a2db468f1"><td class="memTemplParams" colspan="2"><a id="a27607958295e6da8a0ba602a2db468f1"></a>
  200. template&lt;typename X , typename Y &gt; </td></tr>
  201. <tr class="memitem:a27607958295e6da8a0ba602a2db468f1"><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#a27607958295e6da8a0ba602a2db468f1">operator==</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
  202. <tr class="memdesc:a27607958295e6da8a0ba602a2db468f1"><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.The equal function can be called in two differ...">hana::equal</a></code> <br /></td></tr>
  203. <tr class="separator:a27607958295e6da8a0ba602a2db468f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
  204. <tr class="memitem:a0cae3af55edb3eb05bfa184bda633f7d"><td class="memTemplParams" colspan="2"><a id="a0cae3af55edb3eb05bfa184bda633f7d"></a>
  205. template&lt;typename X , typename Y &gt; </td></tr>
  206. <tr class="memitem:a0cae3af55edb3eb05bfa184bda633f7d"><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#a0cae3af55edb3eb05bfa184bda633f7d">operator!=</a> (X &amp;&amp;x, Y &amp;&amp;y)</td></tr>
  207. <tr class="memdesc:a0cae3af55edb3eb05bfa184bda633f7d"><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.The not_equal function can be called in tw...">hana::not_equal</a></code> <br /></td></tr>
  208. <tr class="separator:a0cae3af55edb3eb05bfa184bda633f7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  209. </table><table class="memberdecls">
  210. <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
  211. Public Member Functions</h2></td></tr>
  212. <tr class="memitem:a1ee432be0bd10f08a637a437e311e4e2"><td class="memItemLeft" align="right" valign="top"><a id="a1ee432be0bd10f08a637a437e311e4e2"></a>
  213. constexpr&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a1ee432be0bd10f08a637a437e311e4e2">map</a> ()=default</td></tr>
  214. <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>
  215. <tr class="separator:a1ee432be0bd10f08a637a437e311e4e2"><td class="memSeparator" colspan="2">&#160;</td></tr>
  216. <tr class="memitem:a943219d1c9692938167639d8ad2525b8"><td class="memItemLeft" align="right" valign="top"><a id="a943219d1c9692938167639d8ad2525b8"></a>
  217. 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>
  218. <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>
  219. <tr class="separator:a943219d1c9692938167639d8ad2525b8"><td class="memSeparator" colspan="2">&#160;</td></tr>
  220. <tr class="memitem:a675bb30af155b40f72cbe8607eefbe4e"><td class="memItemLeft" align="right" valign="top"><a id="a675bb30af155b40f72cbe8607eefbe4e"></a>
  221. 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>
  222. <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>
  223. <tr class="separator:a675bb30af155b40f72cbe8607eefbe4e"><td class="memSeparator" colspan="2">&#160;</td></tr>
  224. <tr class="memitem:a4a4f472e036abf9bcbda81e831f46e32"><td class="memTemplParams" colspan="2"><a id="a4a4f472e036abf9bcbda81e831f46e32"></a>
  225. template&lt;typename ... P&gt; </td></tr>
  226. <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>
  227. <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>
  228. <tr class="separator:a4a4f472e036abf9bcbda81e831f46e32"><td class="memSeparator" colspan="2">&#160;</td></tr>
  229. <tr class="memitem:ae18123925b628b5cfcb1adaef5c83ac7"><td class="memItemLeft" align="right" valign="top"><a id="ae18123925b628b5cfcb1adaef5c83ac7"></a>
  230. 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>
  231. <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>
  232. <tr class="separator:ae18123925b628b5cfcb1adaef5c83ac7"><td class="memSeparator" colspan="2">&#160;</td></tr>
  233. <tr class="memitem:a9a6635ea36edc582518d278238defa0d"><td class="memItemLeft" align="right" valign="top"><a id="a9a6635ea36edc582518d278238defa0d"></a>
  234. 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>
  235. <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>
  236. <tr class="separator:a9a6635ea36edc582518d278238defa0d"><td class="memSeparator" colspan="2">&#160;</td></tr>
  237. <tr class="memitem:a4881a1810986e678959af8ccb58f5666"><td class="memTemplParams" colspan="2"><a id="a4881a1810986e678959af8ccb58f5666"></a>
  238. template&lt;typename Key &gt; </td></tr>
  239. <tr class="memitem:a4881a1810986e678959af8ccb58f5666"><td class="memTemplItemLeft" align="right" valign="top">decltype(auto) constexpr&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1map.html#a4881a1810986e678959af8ccb58f5666">operator[]</a> (Key &amp;&amp;key)</td></tr>
  240. <tr class="memdesc:a4881a1810986e678959af8ccb58f5666"><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.Given a key and a Searchable st...">hana::at_key</a></code> <br /></td></tr>
  241. <tr class="separator:a4881a1810986e678959af8ccb58f5666"><td class="memSeparator" colspan="2">&#160;</td></tr>
  242. </table>
  243. <h2 class="groupheader">Associated functions</h2>
  244. <a id="a409d52de54cc7e55eca1a7b5dda4ce30"></a>
  245. <h2 class="memtitle"><span class="permalink"><a href="#a409d52de54cc7e55eca1a7b5dda4ce30">&#9670;&nbsp;</a></span>make&lt; map_tag &gt;</h2>
  246. <div class="memitem">
  247. <div class="memproto">
  248. <div class="memtemplate">
  249. template&lt;typename ... Pairs&gt; </div>
  250. <div class="memtemplate">
  251. template&lt;&gt; </div>
  252. <table class="mlabels">
  253. <tr>
  254. <td class="mlabels-left">
  255. <table class="memname">
  256. <tr>
  257. <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>
  258. </tr>
  259. </table>
  260. </td>
  261. <td class="mlabels-right">
  262. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  263. </tr>
  264. </table>
  265. </div><div class="memdoc">
  266. <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 -->
  267. <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>
  268. <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>
  269. <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>
  270. <h2>Example </h2>
  271. <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 -->
  272. </div>
  273. </div>
  274. <a id="ae73cf43ee56352e4c25984b0fe3c3d04"></a>
  275. <h2 class="memtitle"><span class="permalink"><a href="#ae73cf43ee56352e4c25984b0fe3c3d04">&#9670;&nbsp;</a></span>make_map</h2>
  276. <div class="memitem">
  277. <div class="memproto">
  278. <div class="memtemplate">
  279. template&lt;typename ... Pairs&gt; </div>
  280. <table class="mlabels">
  281. <tr>
  282. <td class="mlabels-left">
  283. <table class="memname">
  284. <tr>
  285. <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>
  286. </tr>
  287. </table>
  288. </td>
  289. <td class="mlabels-right">
  290. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  291. </tr>
  292. </table>
  293. </div><div class="memdoc">
  294. <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>
  295. <h2>Example </h2>
  296. <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 -->
  297. </div>
  298. </div>
  299. <a id="a4feb32bd0a065a0732908716d4855b57"></a>
  300. <h2 class="memtitle"><span class="permalink"><a href="#a4feb32bd0a065a0732908716d4855b57">&#9670;&nbsp;</a></span>to_map</h2>
  301. <div class="memitem">
  302. <div class="memproto">
  303. <div class="memtemplate">
  304. template&lt;typename ... Pairs&gt; </div>
  305. <table class="mlabels">
  306. <tr>
  307. <td class="mlabels-left">
  308. <table class="memname">
  309. <tr>
  310. <td class="memname">constexpr auto to_map = <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>
  311. </tr>
  312. </table>
  313. </td>
  314. <td class="mlabels-right">
  315. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  316. </tr>
  317. </table>
  318. </div><div class="memdoc">
  319. <p>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. </p>
  320. </div>
  321. </div>
  322. <a id="a0f32260f859b2510dd16235b7bc011ac"></a>
  323. <h2 class="memtitle"><span class="permalink"><a href="#a0f32260f859b2510dd16235b7bc011ac">&#9670;&nbsp;</a></span>keys</h2>
  324. <div class="memitem">
  325. <div class="memproto">
  326. <div class="memtemplate">
  327. template&lt;typename ... Pairs&gt; </div>
  328. <table class="mlabels">
  329. <tr>
  330. <td class="mlabels-left">
  331. <table class="memname">
  332. <tr>
  333. <td class="memname">constexpr auto keys</td>
  334. </tr>
  335. </table>
  336. </td>
  337. <td class="mlabels-right">
  338. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  339. </tr>
  340. </table>
  341. </div><div class="memdoc">
  342. <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 -->
  343. <p>Returns a <code>Sequence</code> of the keys of the map, in unspecified order. </p>
  344. <h2>Example </h2>
  345. <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 -->
  346. </div>
  347. </div>
  348. <a id="a2e016a68e3ec6eb25868fadb7ce80132"></a>
  349. <h2 class="memtitle"><span class="permalink"><a href="#a2e016a68e3ec6eb25868fadb7ce80132">&#9670;&nbsp;</a></span>values</h2>
  350. <div class="memitem">
  351. <div class="memproto">
  352. <div class="memtemplate">
  353. template&lt;typename ... Pairs&gt; </div>
  354. <table class="mlabels">
  355. <tr>
  356. <td class="mlabels-left">
  357. <table class="memname">
  358. <tr>
  359. <td class="memname">constexpr auto values</td>
  360. </tr>
  361. </table>
  362. </td>
  363. <td class="mlabels-right">
  364. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  365. </tr>
  366. </table>
  367. </div><div class="memdoc">
  368. <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 -->
  369. <p>Returns a <code>Sequence</code> of the values of the map, in unspecified order. </p>
  370. <h2>Example </h2>
  371. <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 -->
  372. </div>
  373. </div>
  374. <a id="a5791e6dc0e27d8e3a113e4d94482550f"></a>
  375. <h2 class="memtitle"><span class="permalink"><a href="#a5791e6dc0e27d8e3a113e4d94482550f">&#9670;&nbsp;</a></span>insert</h2>
  376. <div class="memitem">
  377. <div class="memproto">
  378. <div class="memtemplate">
  379. template&lt;typename ... Pairs&gt; </div>
  380. <table class="mlabels">
  381. <tr>
  382. <td class="mlabels-left">
  383. <table class="memname">
  384. <tr>
  385. <td class="memname">constexpr auto insert</td>
  386. </tr>
  387. </table>
  388. </td>
  389. <td class="mlabels-right">
  390. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  391. </tr>
  392. </table>
  393. </div><div class="memdoc">
  394. <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 -->
  395. <p>Inserts a new key/value pair in a map. </p>
  396. <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>
  397. <dl class="params"><dt>Parameters</dt><dd>
  398. <table class="params">
  399. <tr><td class="paramname">map</td><td>The map in which to insert a <code>(key,value)</code> pair.</td></tr>
  400. <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>
  401. </table>
  402. </dd>
  403. </dl>
  404. <h2>Example </h2>
  405. <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 -->
  406. </div>
  407. </div>
  408. <a id="af856f7bf77f69cdf1b8fd4e566eaef9b"></a>
  409. <h2 class="memtitle"><span class="permalink"><a href="#af856f7bf77f69cdf1b8fd4e566eaef9b">&#9670;&nbsp;</a></span>erase_key</h2>
  410. <div class="memitem">
  411. <div class="memproto">
  412. <div class="memtemplate">
  413. template&lt;typename ... Pairs&gt; </div>
  414. <table class="mlabels">
  415. <tr>
  416. <td class="mlabels-left">
  417. <table class="memname">
  418. <tr>
  419. <td class="memname">constexpr auto erase_key</td>
  420. </tr>
  421. </table>
  422. </td>
  423. <td class="mlabels-right">
  424. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  425. </tr>
  426. </table>
  427. </div><div class="memdoc">
  428. <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 -->
  429. <p>Removes a key/value pair from a map. </p>
  430. <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>
  431. <dl class="params"><dt>Parameters</dt><dd>
  432. <table class="params">
  433. <tr><td class="paramname">map</td><td>The map in which to erase a <code>key</code>.</td></tr>
  434. <tr><td class="paramname">key</td><td>A key to remove from the map. It must be compile-time <code>Comparable</code>.</td></tr>
  435. </table>
  436. </dd>
  437. </dl>
  438. <h2>Example </h2>
  439. <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 -->
  440. </div>
  441. </div>
  442. <a id="acd511f2c01f38405bfba0b6d5b2922e8"></a>
  443. <h2 class="memtitle"><span class="permalink"><a href="#acd511f2c01f38405bfba0b6d5b2922e8">&#9670;&nbsp;</a></span>union_</h2>
  444. <div class="memitem">
  445. <div class="memproto">
  446. <div class="memtemplate">
  447. template&lt;typename ... Pairs&gt; </div>
  448. <table class="mlabels">
  449. <tr>
  450. <td class="mlabels-left">
  451. <table class="memname">
  452. <tr>
  453. <td class="memname">constexpr auto union_</td>
  454. </tr>
  455. </table>
  456. </td>
  457. <td class="mlabels-right">
  458. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  459. </tr>
  460. </table>
  461. </div><div class="memdoc">
  462. <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 -->
  463. <p>Returns the union of two maps. </p>
  464. <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"><a class="code" href="group__group-Foldable.html#ga38c6b3f6b1cbadb9b8432a05ff16b7d2">hana::fold_left</a>(xs, ys, <a class="code" href="group__group-Sequence.html#gae22a1a184b1b2dd550fa4fa619bed2e9">hana::insert</a>)</div></div><!-- fragment --><dl class="params"><dt>Parameters</dt><dd>
  465. <table class="params">
  466. <tr><td class="paramname">xs,ys</td><td>The two maps to compute the union of.</td></tr>
  467. </table>
  468. </dd>
  469. </dl>
  470. <h2>Example </h2>
  471. <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 -->
  472. </div>
  473. </div>
  474. <a id="a3b3430482d4e88052e621f63a234f3eb"></a>
  475. <h2 class="memtitle"><span class="permalink"><a href="#a3b3430482d4e88052e621f63a234f3eb">&#9670;&nbsp;</a></span>intersection</h2>
  476. <div class="memitem">
  477. <div class="memproto">
  478. <div class="memtemplate">
  479. template&lt;typename ... Pairs&gt; </div>
  480. <table class="mlabels">
  481. <tr>
  482. <td class="mlabels-left">
  483. <table class="memname">
  484. <tr>
  485. <td class="memname">constexpr auto intersection</td>
  486. </tr>
  487. </table>
  488. </td>
  489. <td class="mlabels-right">
  490. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  491. </tr>
  492. </table>
  493. </div><div class="memdoc">
  494. <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 -->
  495. <p>Returns the intersection of two maps. </p>
  496. <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>
  497. <dl class="params"><dt>Parameters</dt><dd>
  498. <table class="params">
  499. <tr><td class="paramname">xs,ys</td><td>Two maps to intersect.</td></tr>
  500. </table>
  501. </dd>
  502. </dl>
  503. <h2>Example </h2>
  504. <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 -->
  505. </div>
  506. </div>
  507. <a id="a718ddfe86437adbbca1e1a5db651d139"></a>
  508. <h2 class="memtitle"><span class="permalink"><a href="#a718ddfe86437adbbca1e1a5db651d139">&#9670;&nbsp;</a></span>difference</h2>
  509. <div class="memitem">
  510. <div class="memproto">
  511. <div class="memtemplate">
  512. template&lt;typename ... Pairs&gt; </div>
  513. <table class="mlabels">
  514. <tr>
  515. <td class="mlabels-left">
  516. <table class="memname">
  517. <tr>
  518. <td class="memname">constexpr auto difference</td>
  519. </tr>
  520. </table>
  521. </td>
  522. <td class="mlabels-right">
  523. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  524. </tr>
  525. </table>
  526. </div><div class="memdoc">
  527. <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 -->
  528. <p>Returns the difference of two maps. </p>
  529. <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>
  530. <dl class="params"><dt>Parameters</dt><dd>
  531. <table class="params">
  532. <tr><td class="paramname">xs,ys</td><td>Two maps to compute the difference of.</td></tr>
  533. </table>
  534. </dd>
  535. </dl>
  536. <h2>Example </h2>
  537. <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 -->
  538. </div>
  539. </div>
  540. <a id="a8bcb2455eb9f7074185d8fb61a99801e"></a>
  541. <h2 class="memtitle"><span class="permalink"><a href="#a8bcb2455eb9f7074185d8fb61a99801e">&#9670;&nbsp;</a></span>symmetric_difference</h2>
  542. <div class="memitem">
  543. <div class="memproto">
  544. <div class="memtemplate">
  545. template&lt;typename ... Pairs&gt; </div>
  546. <table class="mlabels">
  547. <tr>
  548. <td class="mlabels-left">
  549. <table class="memname">
  550. <tr>
  551. <td class="memname">constexpr auto symmetric_difference</td>
  552. </tr>
  553. </table>
  554. </td>
  555. <td class="mlabels-right">
  556. <span class="mlabels"><span class="mlabel">related</span></span> </td>
  557. </tr>
  558. </table>
  559. </div><div class="memdoc">
  560. <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 -->
  561. <p>Returns the symmetric set-theoretic difference of two maps. </p>
  562. <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>
  563. <table class="params">
  564. <tr><td class="paramname">xs,ys</td><td>Two maps to compute the symmetric difference of.</td></tr>
  565. </table>
  566. </dd>
  567. </dl>
  568. <h2>Example </h2>
  569. <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 -->
  570. </div>
  571. </div>
  572. </div><!-- contents -->
  573. </div><!-- doc-content -->
  574. <!--
  575. Copyright Louis Dionne 2013-2017
  576. Distributed under the Boost Software License, Version 1.0.
  577. (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
  578. -->
  579. <!-- boost-no-inspect -->
  580. <!-- HTML footer for doxygen 1.8.9.1-->
  581. <!-- start footer part -->
  582. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  583. <ul>
  584. <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>
  585. </ul>
  586. </div>
  587. </body>
  588. </html>