280 lines
19 KiB
HTML
280 lines
19 KiB
HTML
<!--
|
|
Copyright Louis Dionne 2013-2017
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
|
-->
|
|
<!-- boost-no-inspect -->
|
|
<!-- HTML header for doxygen 1.8.9.1-->
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
|
|
<meta name="generator" content="Doxygen 1.8.20"/>
|
|
<title>Boost.Hana: boost::hana::literals Namespace Reference</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="jquery.js"></script>
|
|
<script type="text/javascript" src="dynsections.js"></script>
|
|
<link href="navtree.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="resize.js"></script>
|
|
<script type="text/javascript" src="navtreedata.js"></script>
|
|
<script type="text/javascript" src="navtree.js"></script>
|
|
<link href="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/searchdata.js"></script>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function() { init_search(); });
|
|
/* @license-end */
|
|
</script>
|
|
<script type="text/x-mathjax-config">
|
|
MathJax.Hub.Config({
|
|
extensions: ["tex2jax.js"],
|
|
jax: ["input/TeX","output/HTML-CSS"],
|
|
});
|
|
// Copyright Louis Dionne 2013-2017
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
|
MathJax.Hub.Config({
|
|
"HTML-CSS": {
|
|
linebreaks: {
|
|
automatic: true,
|
|
width: "75% container"
|
|
}
|
|
}
|
|
});
|
|
</script>
|
|
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css" />
|
|
<!-- Additional javascript for drawing charts. -->
|
|
<script type="text/javascript" src="highcharts.js"></script>
|
|
<script type="text/javascript" src="highcharts-data.js"></script>
|
|
<script type="text/javascript" src="highcharts-exporting.js"></script>
|
|
<script type="text/javascript" src="chart.js"></script>
|
|
<script type="text/javascript" src="hana.js"></script>
|
|
</head>
|
|
<body>
|
|
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
|
<div id="titlearea">
|
|
<table cellspacing="0" cellpadding="0">
|
|
<tbody>
|
|
<tr style="height: 56px;">
|
|
<td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
|
|
<td style="padding-left: 0.5em;">
|
|
<div id="projectname">Boost.Hana
|
|
 <span id="projectnumber">1.7.0</span>
|
|
</div>
|
|
<div id="projectbrief">Your standard library for metaprogramming</div>
|
|
</td>
|
|
<td> <div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.svg"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.20 -->
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
/* @license-end */
|
|
</script>
|
|
</div><!-- top -->
|
|
<div id="side-nav" class="ui-resizable side-nav-resizable">
|
|
<div id="nav-tree">
|
|
<div id="nav-tree-contents">
|
|
<div id="nav-sync" class="sync"></div>
|
|
</div>
|
|
</div>
|
|
<div id="splitbar" style="-moz-user-select:none;"
|
|
class="ui-resizable-handle">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
|
|
$(document).ready(function(){initNavTree('namespaceboost_1_1hana_1_1literals.html',''); initResizable(); });
|
|
/* @license-end */
|
|
</script>
|
|
<div id="doc-content">
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
</div>
|
|
|
|
<!-- iframe showing the search results (closed by default) -->
|
|
<div id="MSearchResultsWindow">
|
|
<iframe src="javascript:void(0)" frameborder="0"
|
|
name="MSearchResults" id="MSearchResults">
|
|
</iframe>
|
|
</div>
|
|
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#func-members">Functions</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">boost::hana::literals Namespace Reference</div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Namespace containing C++14 user-defined literals provided by Hana.
|
|
<a href="namespaceboost_1_1hana_1_1literals.html#details">More...</a></p>
|
|
<table class="memberdecls">
|
|
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
|
|
Functions</h2></td></tr>
|
|
<tr class="memitem:a85ac3c47d02722a334181aab540e732c"><td class="memTemplParams" colspan="2">template<char ... c> </td></tr>
|
|
<tr class="memitem:a85ac3c47d02722a334181aab540e732c"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1hana_1_1literals.html#a85ac3c47d02722a334181aab540e732c">operator""_c</a> ()</td></tr>
|
|
<tr class="memdesc:a85ac3c47d02722a334181aab540e732c"><td class="mdescLeft"> </td><td class="mdescRight">Creates a <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> from a literal. <a href="namespaceboost_1_1hana_1_1literals.html#a85ac3c47d02722a334181aab540e732c">More...</a><br /></td></tr>
|
|
<tr class="separator:a85ac3c47d02722a334181aab540e732c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a325859c7db2c3f8e6a4bfab5a81a6dcb"><td class="memTemplParams" colspan="2">template<typename CharT , CharT ... s> </td></tr>
|
|
<tr class="memitem:a325859c7db2c3f8e6a4bfab5a81a6dcb"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="namespaceboost_1_1hana_1_1literals.html#a325859c7db2c3f8e6a4bfab5a81a6dcb">operator""_s</a> ()</td></tr>
|
|
<tr class="memdesc:a325859c7db2c3f8e6a4bfab5a81a6dcb"><td class="mdescLeft"> </td><td class="mdescRight">Creates a compile-time string from a string literal. <a href="namespaceboost_1_1hana_1_1literals.html#a325859c7db2c3f8e6a4bfab5a81a6dcb">More...</a><br /></td></tr>
|
|
<tr class="separator:a325859c7db2c3f8e6a4bfab5a81a6dcb"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Namespace containing C++14 user-defined literals provided by Hana. </p>
|
|
</div><h2 class="groupheader">Function Documentation</h2>
|
|
<a id="a85ac3c47d02722a334181aab540e732c"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a85ac3c47d02722a334181aab540e732c">◆ </a></span>operator""_c()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<char ... c> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">constexpr auto boost::hana::literals::operator""_c </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">constexpr</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Creates a <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> from a literal. </p>
|
|
<p>The literal is parsed at compile-time and the result is returned as a <code>llong<...></code>.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>We use <code>llong<...></code> instead of <code>ullong<...></code> because using an unsigned type leads to unexpected behavior when doing stuff like <code>-1_c</code>. If we used an unsigned type, <code>-1_c</code> would be something like <code>ullong<-1></code> which is actually <code>ullong<something huge></code>.</dd></dl>
|
|
<h2><a class="anchor" id="autotoc_md251"></a>
|
|
Example</h2>
|
|
<div class="fragment"><div class="line"><span class="keyword">using namespace </span>hana::literals; <span class="comment">// contains the _c suffix</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(1234_c == hana::llong_c<1234>);</div>
|
|
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(-1234_c == hana::llong_c<-1234>);</div>
|
|
<div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(1_c + (3_c * 4_c) == hana::llong_c<1 + (3 * 4)>);</div>
|
|
</div><!-- fragment -->
|
|
</div>
|
|
</div>
|
|
<a id="a325859c7db2c3f8e6a4bfab5a81a6dcb"></a>
|
|
<h2 class="memtitle"><span class="permalink"><a href="#a325859c7db2c3f8e6a4bfab5a81a6dcb">◆ </a></span>operator""_s()</h2>
|
|
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<div class="memtemplate">
|
|
template<typename CharT , CharT ... s> </div>
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">constexpr auto boost::hana::literals::operator""_s </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">constexpr</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Creates a compile-time string from a string literal. </p>
|
|
<p>The string literal is parsed at compile-time and the result is returned as a <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code>. This feature is an extension that is disabled by default; see below for details.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>Only narrow string literals are supported right now; support for fancier types of string literals like wide or UTF-XX might be added in the future if there is a demand for it. See <a href="https://github.com/boostorg/hana/issues/80">this issue</a> if you need this.</dd></dl>
|
|
<dl class="section warning"><dt>Warning</dt><dd>This user-defined literal is an extension which requires a special string literal operator that is not part of the standard yet. That operator is supported by both Clang and GCC, and several proposals were made for it to enter C++17. However, since it is not standard, it is disabled by default and defining the <code>BOOST_HANA_CONFIG_ENABLE_STRING_UDL</code> config macro is required to get this operator. Hence, if you want to stay safe, just use the <code>BOOST_HANA_STRING</code> macro instead. If you want to be fast and furious (I do), define <code>BOOST_HANA_CONFIG_ENABLE_STRING_UDL</code>.</dd></dl>
|
|
<h2><a class="anchor" id="autotoc_md375"></a>
|
|
Example</h2>
|
|
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
|
|
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
|
|
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="config_8hpp.html">boost/hana/config.hpp</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="core_2is__a_8hpp.html">boost/hana/core/is_a.hpp</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="equal_8hpp.html">boost/hana/equal.hpp</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="integral__constant_8hpp.html">boost/hana/integral_constant.hpp</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="length_8hpp.html">boost/hana/length.hpp</a>></span></div>
|
|
<div class="line"><span class="preprocessor">#include <<a class="code" href="string_8hpp.html">boost/hana/string.hpp</a>></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="comment">// By default, this is disabled</span></div>
|
|
<div class="line"><span class="preprocessor">#ifdef BOOST_HANA_CONFIG_ENABLE_STRING_UDL</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"> constexpr <span class="keyword">auto</span> str = <span class="stringliteral">"Hello world!"</span>_s;</div>
|
|
<div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(str == hana::string_c<<span class="charliteral">'H'</span>, <span class="charliteral">'e'</span>, <span class="charliteral">'l'</span>, <span class="charliteral">'l'</span>, <span class="charliteral">'o'</span>, <span class="charliteral">' '</span>,</div>
|
|
<div class="line"> <span class="charliteral">'w'</span>, <span class="charliteral">'o'</span>, <span class="charliteral">'r'</span>, <span class="charliteral">'l'</span>, <span class="charliteral">'d'</span>, <span class="charliteral">'!'</span>>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::is_a<hana::string_tag>(str));</div>
|
|
<div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(<a class="code" href="group__group-_foldable.html#gaf0f8f717245620dc28cd7d7fa44d7475">hana::length</a>(str) == hana::size_c<12>);</div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="preprocessor">#endif</span></div>
|
|
<div class="line"> </div>
|
|
<div class="line"><span class="keywordtype">int</span> main() { }</div>
|
|
</div><!-- fragment -->
|
|
<p class="reference">References <a class="el" href="group__group-_constant.html#ga1687520692a6b0c49e3a69de2980f388">boost::hana::value</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
</div><!-- contents -->
|
|
</div><!-- doc-content -->
|
|
<div class="ttc" id="aequal_8hpp_html"><div class="ttname"><a href="equal_8hpp.html">equal.hpp</a></div><div class="ttdoc">Defines boost::hana::equal.</div></div>
|
|
<div class="ttc" id="agroup__group-assertions_html_ga2c5006540936d9f8880e3a39f4fcc035"><div class="ttname"><a href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a></div><div class="ttdeci">#define BOOST_HANA_CONSTANT_CHECK(...)</div><div class="ttdoc">Equivalent to BOOST_HANA_CONSTANT_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTI...</div><div class="ttdef"><b>Definition:</b> assert.hpp:239</div></div>
|
|
<div class="ttc" id="aconfig_8hpp_html"><div class="ttname"><a href="config_8hpp.html">config.hpp</a></div><div class="ttdoc">Defines configuration macros used throughout the library.</div></div>
|
|
<div class="ttc" id="acore_2is__a_8hpp_html"><div class="ttname"><a href="core_2is__a_8hpp.html">is_a.hpp</a></div><div class="ttdoc">Defines boost::hana::is_a and boost::hana::is_an.</div></div>
|
|
<div class="ttc" id="aintegral__constant_8hpp_html"><div class="ttname"><a href="integral__constant_8hpp.html">integral_constant.hpp</a></div><div class="ttdoc">Defines boost::hana::integral_constant.</div></div>
|
|
<div class="ttc" id="astring_8hpp_html"><div class="ttname"><a href="string_8hpp.html">string.hpp</a></div><div class="ttdoc">Defines boost::hana::string.</div></div>
|
|
<div class="ttc" id="agroup__group-_foldable_html_gaf0f8f717245620dc28cd7d7fa44d7475"><div class="ttname"><a href="group__group-_foldable.html#gaf0f8f717245620dc28cd7d7fa44d7475">boost::hana::length</a></div><div class="ttdeci">constexpr auto length</div><div class="ttdoc">Return the number of elements in a foldable structure.</div><div class="ttdef"><b>Definition:</b> length.hpp:34</div></div>
|
|
<div class="ttc" id="anamespaceboost_1_1hana_html"><div class="ttname"><a href="namespaceboost_1_1hana.html">boost::hana</a></div><div class="ttdoc">Namespace containing everything in the library.</div><div class="ttdef"><b>Definition:</b> accessors.hpp:20</div></div>
|
|
<div class="ttc" id="aassert_8hpp_html"><div class="ttname"><a href="assert_8hpp.html">assert.hpp</a></div><div class="ttdoc">Defines macros to perform different kinds of assertions.</div></div>
|
|
<div class="ttc" id="alength_8hpp_html"><div class="ttname"><a href="length_8hpp.html">length.hpp</a></div><div class="ttdoc">Defines boost::hana::length.</div></div>
|
|
<!--
|
|
Copyright Louis Dionne 2013-2017
|
|
Distributed under the Boost Software License, Version 1.0.
|
|
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
|
|
-->
|
|
<!-- boost-no-inspect -->
|
|
<!-- HTML footer for doxygen 1.8.9.1-->
|
|
<!-- start footer part -->
|
|
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
|
<ul>
|
|
<li class="navelem"><b>boost</b></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana.html">hana</a></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana_1_1literals.html">literals</a></li>
|
|
</ul>
|
|
</div>
|
|
</body>
|
|
</html>
|