Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / hana / doc / html / group__group-Constant.html
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.11"/>
14 <title>Boost.Hana: Constant</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   $(document).ready(initResizable);
24   $(window).load(resizeHeight);
25 </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   $(document).ready(function() { init_search(); });
31 </script>
32 <script type="text/x-mathjax-config">
33   MathJax.Hub.Config({
34     extensions: ["tex2jax.js"],
35     jax: ["input/TeX","output/HTML-CSS"],
36 });
37 // Copyright Louis Dionne 2013-2017
38 // Distributed under the Boost Software License, Version 1.0.
39 // (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
40 MathJax.Hub.Config({
41     "HTML-CSS": {
42         linebreaks: {
43             automatic: true,
44             width: "75% container"
45         }
46     }
47 });
48 </script><script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
49 <link href="doxygen.css" rel="stylesheet" type="text/css" />
50 <!-- Additional javascript for drawing charts. -->
51 <script type="text/javascript" src="highcharts.js"></script>
52 <script type="text/javascript" src="highcharts-data.js"></script>
53 <script type="text/javascript" src="highcharts-exporting.js"></script>
54 <script type="text/javascript" src="chart.js"></script>
55 <script type="text/javascript" src="hana.js"></script>
56 </head>
57 <body>
58 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
59 <div id="titlearea">
60 <table cellspacing="0" cellpadding="0">
61  <tbody>
62  <tr style="height: 56px;">
63   <td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
64   <td style="padding-left: 0.5em;">
65    <div id="projectname">Boost.Hana
66    &#160;<span id="projectnumber">1.1.0</span>
67    </div>
68    <div id="projectbrief">Your standard library for metaprogramming</div>
69   </td>
70    <td>        <div id="MSearchBox" class="MSearchBoxInactive">
71         <span class="left">
72           <img id="MSearchSelect" src="search/mag_sel.png"
73                onmouseover="return searchBox.OnSearchSelectShow()"
74                onmouseout="return searchBox.OnSearchSelectHide()"
75                alt=""/>
76           <input type="text" id="MSearchField" value="Search" accesskey="S"
77                onfocus="searchBox.OnSearchFieldFocus(true)" 
78                onblur="searchBox.OnSearchFieldFocus(false)" 
79                onkeyup="searchBox.OnSearchFieldChange(event)"/>
80           </span><span class="right">
81             <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
82           </span>
83         </div>
84 </td>
85  </tr>
86  </tbody>
87 </table>
88 </div>
89 <!-- end header part -->
90 <!-- Generated by Doxygen 1.8.11 -->
91 <script type="text/javascript">
92 var searchBox = new SearchBox("searchBox", "search",false,'Search');
93 </script>
94 </div><!-- top -->
95 <div id="side-nav" class="ui-resizable side-nav-resizable">
96   <div id="nav-tree">
97     <div id="nav-tree-contents">
98       <div id="nav-sync" class="sync"></div>
99     </div>
100   </div>
101   <div id="splitbar" style="-moz-user-select:none;" 
102        class="ui-resizable-handle">
103   </div>
104 </div>
105 <script type="text/javascript">
106 $(document).ready(function(){initNavTree('group__group-Constant.html','');});
107 </script>
108 <div id="doc-content">
109 <!-- window showing the filter options -->
110 <div id="MSearchSelectWindow"
111      onmouseover="return searchBox.OnSearchSelectShow()"
112      onmouseout="return searchBox.OnSearchSelectHide()"
113      onkeydown="return searchBox.OnSearchSelectKey(event)">
114 </div>
115
116 <!-- iframe showing the search results (closed by default) -->
117 <div id="MSearchResultsWindow">
118 <iframe src="javascript:void(0)" frameborder="0" 
119         name="MSearchResults" id="MSearchResults">
120 </iframe>
121 </div>
122
123 <div class="header">
124   <div class="summary">
125 <a href="#var-members">Variables</a>  </div>
126   <div class="headertitle">
127 <div class="title">Constant<div class="ingroups"><a class="el" href="group__group-concepts.html">Concepts</a></div></div>  </div>
128 </div><!--header-->
129 <div class="contents">
130 <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
131 <p>The <code>Constant</code> concept represents data that can be manipulated at compile-time. </p>
132 <p>At its core, <code>Constant</code> is simply a generalization of the principle behind <code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants. ">std::integral_constant</a></code> to all types that can be constructed at compile-time, i.e. to all types with a <code>constexpr</code> constructor (also called <a href="http://en.cppreference.com/w/cpp/concept/LiteralType">Literal types</a>). More specifically, a <code>Constant</code> is an object from which a <code>constexpr</code> value may be obtained (through the <code>value</code> method) regardless of the <code>constexpr</code>ness of the object itself.</p>
133 <p>All <code>Constant</code>s must be somewhat equivalent, in the following sense. Let <code>C(T)</code> and <code>D(U)</code> denote the tags of <code>Constant</code>s holding objects of type <code>T</code> and <code>U</code>, respectively. Then, an object with tag <code>D(U)</code> must be convertible to an object with tag <code>C(T)</code> whenever <code>U</code> is convertible to <code>T</code>, as determined by <code><a class="el" href="structboost_1_1hana_1_1is__convertible.html" title="Returns whether there is a Hana-conversion from a data type to another. ">is_convertible</a></code>. The interpretation here is that a <code>Constant</code> is just a box holding an object of some type, and it should be possible to swap between boxes whenever the objects inside the boxes can be swapped.</p>
134 <p>Because of this last requirement, one could be tempted to think that specialized "boxes" like <code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants. ">std::integral_constant</a></code> are prevented from being <code>Constant</code>s because they are not able to hold objects of any type <code>T</code> (<code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants. ">std::integral_constant</a></code> may only hold integral types). This is false; the requirement should be interpreted as saying that whenever <code>C(T)</code> is <em>meaningful</em> (e.g. only when <code>T</code> is integral for <code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants. ">std::integral_constant</a></code>) <em>and</em> there exists a conversion from <code>U</code> to <code>T</code>, then a conversion from <code>D(U)</code> to <code>C(T)</code> should also exist. The precise requirements for being a <code>Constant</code> are embodied in the following laws.</p>
135 <h2>Minimal complete definition </h2>
136 <p><code>value</code> and <code>to</code>, satisfying the laws below.</p>
137 <h2>Laws </h2>
138 <p>Let <code>c</code> be an object of with tag <code>C</code>, which represents a <code>Constant</code> holding an object with tag <code>T</code>. The first law ensures that the value of the wrapped object is always a constant expression by requiring the following to be well-formed: </p><div class="fragment"><div class="line">constexpr <span class="keyword">auto</span> x = hana::value&lt;decltype(c)&gt;();</div></div><!-- fragment --><p>This means that the <code>value</code> function must return an object that can be constructed at compile-time. It is important to note how <code>value</code> only receives the type of the object and not the object itself. This is the core of the <code>Constant</code> concept; it means that the only information required to implement <code>value</code> must be stored in the <em>type</em> of its argument, and hence be available statically.</p>
139 <p>The second law that must be satisfied ensures that <code>Constant</code>s are basically dumb boxes, which makes it possible to provide models for many concepts without much work from the user. The law simply asks for the following expression to be valid: </p><div class="fragment"><div class="line">to&lt;C&gt;(i)</div></div><!-- fragment --><p> where, <code>i</code> is an <em>arbitrary</em> <code>Constant</code> holding an internal value with a tag that can be converted to <code>T</code>, as determined by the <code><a class="el" href="structboost_1_1hana_1_1is__convertible.html" title="Returns whether there is a Hana-conversion from a data type to another. ">hana::is_convertible</a></code> metafunction. In other words, whenever <code>U</code> is convertible to <code>T</code>, a <code>Constant</code> holding a <code>U</code> is convertible to a <code>Constant</code> holding a <code>T</code>, if such a <code>Constant</code> can be created.</p>
140 <p>Finally, the tag <code>C</code> must provide a nested <code>value_type</code> alias to <code>T</code>, which allows us to query the tag of the inner value held by objects with tag <code>C</code>. In other words, the following must be true for any object <code>c</code> with tag <code>C</code>: </p><div class="fragment"><div class="line">std::is_same&lt;</div><div class="line">    C::value_type,</div><div class="line">    tag_of&lt;decltype(hana::value(c))&gt;::type</div><div class="line">&gt;<a class="code" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">::value</a></div></div><!-- fragment --><h2>Refined concepts </h2>
141 <p>In certain cases, a <code>Constant</code> can automatically be made a model of another concept. In particular, if a <code>Constant</code> <code>C</code> is holding an object of tag <code>T</code>, and if <code>T</code> models a concept <code>X</code>, then <code>C</code> may in most cases model <code>X</code> by simply performing whatever operation is required on its underlying value, and then wrapping the result back in a <code>C</code>.</p>
142 <p>More specifically, if a <code>Constant</code> <code>C</code> has an underlying value (<code>C::value_type</code>) which is a model of <code>Comparable</code>, <code>Orderable</code>, <code>Logical</code>, or <code>Monoid</code> up to <code>EuclideanRing</code>, then <code>C</code> must also be a model of those concepts. In other words, when <code>C::value_type</code> models one of the listed concepts, <code>C</code> itself must also model that concept. However, note that free models are provided for all of those concepts, so no additional work must be done.</p>
143 <p>While it would be possible in theory to provide models for concepts like <code>Foldable</code> too, only a couple of concepts are useful to have as <code>Constant</code> in practice. Providing free models for the concepts listed above is useful because it allows various types of integral constants (<code><a class="el" href="structstd_1_1integral__constant.html" title="Adapter for std::integral_constants. ">std::integral_constant</a></code>, <code><a class="el" href="structboost_1_1mpl_1_1integral__c.html" title="Adapter for IntegralConstants from the Boost.MPL. ">mpl::integral_c</a></code>, etc...) to easily have models for them just by defining the <code>Constant</code> concept.</p>
144 <dl class="section remark"><dt>Remarks</dt><dd>An interesting observation is that <code>Constant</code> is actually the canonical embedding of the subcategory of <code>constexpr</code> things into the Hana category, which contains everything in this library. Hence, whatever is true in that subcategory is also true here, via this functor. This is why we can provide models of any concept that works on <code>constexpr</code> things for Constants, by simply passing them through that embedding.</dd></dl>
145 <h2>Concrete models </h2>
146 <p><code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type. ">hana::integral_constant</a></code></p>
147 <h2>Provided conversion to the tag of the underlying value </h2>
148 <p>Any <code>Constant</code> <code>c</code> holding an underlying value of tag <code>T</code> is convertible to any tag <code>U</code> such that <code>T</code> is convertible to <code>U</code>. Specifically, the conversion is equivalent to </p><div class="fragment"><div class="line">to&lt;U&gt;(c) == to&lt;U&gt;(<a class="code" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">value</a>&lt;decltype(c)&gt;())</div></div><!-- fragment --><p>Also, those conversions are marked as an embedding whenever the conversion of underlying types is an embedding. This is to allow Constants to inter-operate with <code>constexpr</code> objects easily: </p><div class="fragment"><div class="line"><a class="code" href="group__group-Monoid.html#gaeb5d4a1e967e319712f9e4791948896c">plus</a>(int_c&lt;1&gt;, 1) == 2</div></div><!-- fragment --><p>Strictly speaking, <b>this is sometimes a violation</b> of what it means to be an embedding. Indeed, while there exists an embedding from any Constant to a <code>constexpr</code> object (since Constant is just the canonical inclusion), there is no embedding from a Constant to a runtime object since we would lose the ability to define the <code>value</code> method (the <code>constexpr</code>ness of the object would have been lost). Since there is no way to distinguish <code>constexpr</code> and non-<code>constexpr</code> objects based on their type, Hana has no way to know whether the conversion is to a <code>constexpr</code> object of not. In other words, the <code>to</code> method has no way to differentiate between </p><div class="fragment"><div class="line">constexpr <span class="keywordtype">int</span> i = hana::to&lt;int&gt;(int_c&lt;1&gt;);</div></div><!-- fragment --><p> which is an embedding, and </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> i = hana::to&lt;int&gt;(int_c&lt;1&gt;);</div></div><!-- fragment --><p>which isn't. To be on the safer side, we could mark the conversion as not-an-embedding. However, if e.g. the conversion from <code><a class="el" href="structboost_1_1hana_1_1integral__constant__tag.html" title="Tag representing hana::integral_constant. ">integral_constant_tag</a>&lt;int&gt;</code> to <code>int</code> was not marked as an embedding, we would have to write <code>plus(to&lt;int&gt;(int_c&lt;1&gt;), 1)</code> instead of just <code>plus(int_c&lt;1&gt;, 1)</code>, which is cumbersome. Hence, the conversion is marked as an embedding, but this also means that code like </p><div class="fragment"><div class="line"><span class="keywordtype">int</span> i = 1;</div><div class="line"><a class="code" href="group__group-Monoid.html#gaeb5d4a1e967e319712f9e4791948896c">plus</a>(int_c&lt;1&gt;, i);</div></div><!-- fragment --><p> will be considered valid, which implicitly loses the fact that <code>int_c&lt;1&gt;</code> is a Constant, and hence does not follow the usual rules for cross-type operations in Hana.</p>
149 <h2>Provided common data type </h2>
150 <p>Because of the requirement that <code>Constant</code>s be interchangeable when their contents are compatible, two <code>Constant</code>s <code>A</code> and <code>B</code> will have a common data type whenever <code>A::value_type</code> and <code>B::value_type</code> have one. Their common data type is an unspecified <code>Constant</code> <code>C</code> such that <code>C::value_type</code> is exactly <code>common_t&lt;A::value_type, B::value_type&gt;</code>. A specialization of the <code>common</code> metafunction is provided for <code>Constant</code>s to reflect this.</p>
151 <p>In the same vein, a common data type is also provided from any constant <code>A</code> to a type <code>T</code> such that <code>A::value_type</code> and <code>T</code> share a common type. The common type between <code>A</code> and <code>T</code> is obviously the common type between <code>A::value_type</code> and <code>T</code>. As explained above in the section on conversions, this is sometimes a violation of the definition of a common type, because there must be an embedding to the common type, which is not always the case. For the same reasons as explained above, this common type is still provided.</p>
152 <table class="memberdecls">
153 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="var-members"></a>
154 Variables</h2></td></tr>
155 <tr class="memitem:ga1687520692a6b0c49e3a69de2980f388"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
156 <tr class="memitem:ga1687520692a6b0c49e3a69de2980f388"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">boost::hana::value</a></td></tr>
157 <tr class="memdesc:ga1687520692a6b0c49e3a69de2980f388"><td class="mdescLeft">&#160;</td><td class="mdescRight">Return the compile-time value associated to a constant.This function returns the value associated to a <code>Constant</code>. That value is always a constant expression. The normal way of using <code>value</code> on an object <code>c</code> is.  <a href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">More...</a><br /></td></tr>
158 <tr class="separator:ga1687520692a6b0c49e3a69de2980f388"><td class="memSeparator" colspan="2">&#160;</td></tr>
159 <tr class="memitem:gab46a092deeb205f2c92c335d4312a991"><td class="memItemLeft" align="right" valign="top">constexpr auto&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group-Constant.html#gab46a092deeb205f2c92c335d4312a991">boost::hana::value_of</a></td></tr>
160 <tr class="memdesc:gab46a092deeb205f2c92c335d4312a991"><td class="mdescLeft">&#160;</td><td class="mdescRight">Equivalent to <code>value</code>, but can be passed to higher-order algorithms.This function object is equivalent to <code>value</code>, except it can be passed to higher order algorithms because it is a function object. <code>value</code> can't be passed to higher-order algorithms because it is implemented as an overloaded function.  <a href="group__group-Constant.html#gab46a092deeb205f2c92c335d4312a991">More...</a><br /></td></tr>
161 <tr class="separator:gab46a092deeb205f2c92c335d4312a991"><td class="memSeparator" colspan="2">&#160;</td></tr>
162 </table>
163 <h2 class="groupheader">Variable Documentation</h2>
164 <a class="anchor" id="ga1687520692a6b0c49e3a69de2980f388"></a>
165 <div class="memitem">
166 <div class="memproto">
167 <div class="memtemplate">
168 template&lt;typename T &gt; </div>
169       <table class="memname">
170         <tr>
171           <td class="memname">constexpr auto boost::hana::value</td>
172         </tr>
173       </table>
174 </div><div class="memdoc">
175
176 <p><code>#include &lt;<a class="el" href="fwd_2value_8hpp.html">boost/hana/fwd/value.hpp</a>&gt;</code></p>
177 <b>Initial value:</b><div class="fragment"><div class="line">= []() -&gt; decltype(<span class="keyword">auto</span>) {</div><div class="line">        <span class="keywordflow">return</span> tag-dispatched;</div><div class="line">    }</div></div><!-- fragment -->
178 <p>Return the compile-time value associated to a constant.This function returns the value associated to a <code>Constant</code>. That value is always a constant expression. The normal way of using <code>value</code> on an object <code>c</code> is. </p>
179 <div class="fragment"><div class="line">constexpr <span class="keyword">auto</span> result = hana::value&lt;decltype(c)&gt;();</div></div><!-- fragment --><p>However, for convenience, an overload of <code>value</code> is provided so that it can be called as: </p><div class="fragment"><div class="line">constexpr <span class="keyword">auto</span> result = <a class="code" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">hana::value</a>(c);</div></div><!-- fragment --><p>This overload works by taking a <code>const&amp;</code> to its argument, and then forwarding to the first version of <code>value</code>. Since it does not use its argument, the result can still be a constant expression, even if the argument is not a constant expression.</p>
180 <dl class="section note"><dt>Note</dt><dd><code>value&lt;T&gt;()</code> is tag-dispatched as <code>value_impl&lt;C&gt;::apply&lt;T&gt;()</code>, where <code>C</code> is the tag of <code>T</code>.</dd>
181 <dd>
182 <code><a class="el" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388" title="Return the compile-time value associated to a constant.This function returns the value associated to ...">hana::value</a></code> is an overloaded function, not a function object. Hence, it can't be passed to higher-order algorithms. If you need an equivalent function object, use <code><a class="el" href="group__group-Constant.html#gab46a092deeb205f2c92c335d4312a991" title="Equivalent to value, but can be passed to higher-order algorithms.This function object is equivalent ...">hana::value_of</a></code> instead.</dd></dl>
183 <h2>Example </h2>
184 <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="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="value_8hpp.html">boost/hana/value.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="keyword">auto</span> i = hana::integral_c&lt;int, 3&gt;; <span class="comment">// notice no constexpr</span></div><div class="line">    static_assert(<a class="code" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">hana::value</a>&lt;decltype(i)&gt;() == 3, <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">    static_assert(<a class="code" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">hana::value</a>(i) == 3, <span class="stringliteral">&quot;value(i) is always a constant expression!&quot;</span>);</div><div class="line">}</div></div><!-- fragment --> 
185 <p>Referenced by <a class="el" href="namespaceboost_1_1hana_1_1literals.html#a85ac3c47d02722a334181aab540e732c">boost::hana::literals::operator&quot;&quot;_c()</a>, <a class="el" href="namespaceboost_1_1hana_1_1literals.html#a325859c7db2c3f8e6a4bfab5a81a6dcb">boost::hana::literals::operator&quot;&quot;_s()</a>, and <a class="el" href="structboost_1_1hana_1_1optional.html#adf824827b5d6f8c87d23b9526b9f35d2">boost::hana::optional&lt; T &gt;::optional()</a>.</p>
186
187 </div>
188 </div>
189 <a class="anchor" id="gab46a092deeb205f2c92c335d4312a991"></a>
190 <div class="memitem">
191 <div class="memproto">
192       <table class="memname">
193         <tr>
194           <td class="memname">constexpr auto boost::hana::value_of</td>
195         </tr>
196       </table>
197 </div><div class="memdoc">
198
199 <p><code>#include &lt;<a class="el" href="fwd_2value_8hpp.html">boost/hana/fwd/value.hpp</a>&gt;</code></p>
200 <b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span> <span class="keyword">const</span>&amp; c) -&gt; decltype(<span class="keyword">auto</span>) {</div><div class="line">        <span class="keywordflow">return</span> hana::value(c);</div><div class="line">    }</div></div><!-- fragment -->
201 <p>Equivalent to <code>value</code>, but can be passed to higher-order algorithms.This function object is equivalent to <code>value</code>, except it can be passed to higher order algorithms because it is a function object. <code>value</code> can't be passed to higher-order algorithms because it is implemented as an overloaded function. </p>
202 <dl class="section note"><dt>Note</dt><dd>This function is a simple alias to <code>value</code>, and hence it is not tag-dispatched and can't be customized.</dd></dl>
203 <h2>Example </h2>
204 <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="equal_8hpp.html">boost/hana/equal.hpp</a>&gt;</span></div><div class="line"><span class="preprocessor">#include &lt;<a class="code" href="transform_8hpp.html">boost/hana/transform.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="value_8hpp.html">boost/hana/value.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">    constexpr <span class="keyword">auto</span> xs = hana::tuple_c&lt;int, 1, 2, 3, 4, 5&gt;;</div><div class="line">    constexpr <span class="keyword">auto</span> vs = <a class="code" href="group__group-Functor.html#ga5a8975f6e55375d5b6038a9c36ee63e7">hana::transform</a>(xs, <a class="code" href="group__group-Constant.html#gab46a092deeb205f2c92c335d4312a991">hana::value_of</a>);</div><div class="line">    static_assert(vs == hana::make_tuple(1, 2, 3, 4, 5), <span class="stringliteral">&quot;&quot;</span>);</div><div class="line">}</div></div><!-- fragment --> 
205 </div>
206 </div>
207 </div><!-- contents -->
208 </div><!-- doc-content -->
209 <!--
210 Copyright Louis Dionne 2013-2017
211 Distributed under the Boost Software License, Version 1.0.
212 (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
213 -->
214 <!-- boost-no-inspect -->
215 <!-- HTML footer for doxygen 1.8.9.1-->
216 <!-- start footer part -->
217 <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
218   <ul>
219   </ul>
220 </div>
221 </body>
222 </html>