123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441 |
- <!--
- 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.15"/>
- <title>Boost.Hana: boost::hana::string< implementation_defined > Struct Template Reference</title>
- <link href="tabs.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript" src="dynsections.js"></script>
- <link href="navtree.css" rel="stylesheet" type="text/css"/>
- <script type="text/javascript" src="resize.js"></script>
- <script type="text/javascript" src="navtreedata.js"></script>
- <script type="text/javascript" src="navtree.js"></script>
- <script type="text/javascript">
- /* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */
- $(document).ready(initResizable);
- /* @license-end */</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.6.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.png"
- 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.png" alt=""/></a>
- </span>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- end header part -->
- <!-- Generated by Doxygen 1.8.15 -->
- <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('structboost_1_1hana_1_1string.html','');});
- /* @license-end */
- </script>
- <div id="doc-content">
- <!-- window showing the filter options -->
- <div id="MSearchSelectWindow"
- onmouseover="return searchBox.OnSearchSelectShow()"
- onmouseout="return searchBox.OnSearchSelectHide()"
- onkeydown="return searchBox.OnSearchSelectKey(event)">
- </div>
- <!-- iframe showing the search results (closed by default) -->
- <div id="MSearchResultsWindow">
- <iframe src="javascript:void(0)" frameborder="0"
- name="MSearchResults" id="MSearchResults">
- </iframe>
- </div>
- <div class="header">
- <div class="summary">
- <a href="#related">Synopsis of associated functions</a> |
- <a href="#friends">Friends</a> |
- <a href="#pub-methods">Public Member Functions</a> |
- <a href="#pub-static-methods">Static Public Member Functions</a> |
- <a href="structboost_1_1hana_1_1string-members.html">List of all members</a> </div>
- <div class="headertitle">
- <div class="title">boost::hana::string< implementation_defined > Struct Template Reference<div class="ingroups"><a class="el" href="group__group-datatypes.html">Data types</a></div></div> </div>
- </div><!--header-->
- <div class="contents">
- <a name="details" id="details"></a><h2 class="groupheader">Description</h2>
- <div class="textblock"><h3>template<typename implementation_defined><br />
- struct boost::hana::string< implementation_defined ></h3>
- <p>Compile-time string. </p>
- <p>Conceptually, a <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> is like a tuple holding <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s of underlying type <code>char</code>. However, the interface of <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> is not as rich as that of a tuple, because a string can only hold compile-time characters as opposed to any kind of object.</p>
- <p>Compile-time strings are used for simple purposes like being keys in 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> or tagging the members of a <code>Struct</code>. However, you might find that <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> does not provide enough functionality to be used as a full-blown compile-time string implementation (e.g. regexp matching or substring finding). Indeed, providing a comprehensive string interface is a lot of job, and it is out of the scope of the library for the time being.</p>
- <dl class="section note"><dt>Note</dt><dd>The representation of <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> is implementation-defined. In particular, one should not take for granted that the template parameters are <code>char</code>s. The proper way to access the contents of a <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> as character constants is to use <code><a class="el" href="group__group-Foldable.html#ga7b0c23944364ce61136e10b978ae2170" title="Invoke a function with the elements of a Foldable as arguments.Given a function and a foldable struct...">hana::unpack</a></code>, <code>.<a class="el" href="structboost_1_1hana_1_1string.html#af21839d798df54bcbe3d552740f3b16b" title="Returns a null-delimited C-style string.">c_str()</a></code> or <code><a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e" title="Converts an object from one data type to another.">hana::to</a><char const*></code>, as documented below. More details <a class="el" href="index.html#tutorial-containers-types">in the tutorial</a>.</dd></dl>
- <h2>Modeled concepts </h2>
- <p>For most purposes, a <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> is functionally equivalent to a tuple holding <code>Constant</code>s of underlying type <code>char</code>.</p>
- <ol type="1">
- <li><code>Comparable</code><br />
- Two strings are equal if and only if they have the same number of characters and characters at corresponding indices are equal. <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="equal_8hpp.html">boost/hana/equal.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="not__equal_8hpp.html">boost/hana/not_equal.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"></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#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(</div><div class="line"> <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcdef"</span>) == <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcdef"</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>(</div><div class="line"> <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcdef"</span>) != <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abef"</span>)</div><div class="line"> );</div><div class="line">}</div></div><!-- fragment --></li>
- <li><code>Orderable</code><br />
- The total order implemented for <code>Orderable</code> is the usual lexicographical comparison of strings. <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="greater_8hpp.html">boost/hana/greater.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="less_8hpp.html">boost/hana/less.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"></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#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(</div><div class="line"> <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abc"</span>) < <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"bcd"</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>(</div><div class="line"> <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcd"</span>) > <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abc"</span>)</div><div class="line"> );</div><div class="line">}</div></div><!-- fragment --></li>
- <li><code>Monoid</code><br />
- Strings form a monoid under concatenation, with the neutral element being the empty string. <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="equal_8hpp.html">boost/hana/equal.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="plus_8hpp.html">boost/hana/plus.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"></div><div class="line"></div><div class="line"><span class="keyword">auto</span> hello_world = <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"Hello "</span>) + <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"world!"</span>);</div><div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hello_world == <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"Hello world!"</span>));</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() { }</div></div><!-- fragment --></li>
- <li><code>Foldable</code><br />
- Folding a string is equivalent to folding the sequence of its characters. <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="equal_8hpp.html">boost/hana/equal.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="fold__left_8hpp.html">boost/hana/fold_left.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="plus_8hpp.html">boost/hana/plus.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="preprocessor">#include <<a class="code" href="value_8hpp.html">boost/hana/value.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"></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() {</div><div class="line"> <span class="keyword">auto</span> sum_string = [](<span class="keyword">auto</span> str) {</div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="group__group-Foldable.html#ga38c6b3f6b1cbadb9b8432a05ff16b7d2">hana::fold_left</a>(str, hana::int_c<0>, [](<span class="keyword">auto</span> <a class="code" href="group__group-Foldable.html#ga650def4b2e98f4273d8b9b7aa5a2fc28">sum</a>, <span class="keyword">auto</span> c) {</div><div class="line"> constexpr <span class="keywordtype">int</span> i = <a class="code" href="group__group-Constant.html#ga1687520692a6b0c49e3a69de2980f388">hana::value</a>(c) - 48; <span class="comment">// convert character to decimal</span></div><div class="line"> <span class="keywordflow">return</span> <a class="code" href="group__group-Foldable.html#ga650def4b2e98f4273d8b9b7aa5a2fc28">sum</a> + hana::int_c<i>;</div><div class="line"> });</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>(</div><div class="line"> sum_string(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"1234"</span>)) == hana::int_c<1 + 2 + 3 + 4></div><div class="line"> );</div><div class="line">}</div></div><!-- fragment --></li>
- <li><code>Iterable</code><br />
- Iterating over a string is equivalent to iterating over the sequence of its characters. Also note that <code>operator[]</code> can be used instead of the <code>at</code> function. <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="contains_8hpp.html">boost/hana/contains.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="drop__while_8hpp.html">boost/hana/drop_while.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="is__empty_8hpp.html">boost/hana/is_empty.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"></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#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(!<a class="code" href="group__group-Iterable.html#ga2a05f564f8a7e4afa04fcbc07ad8f394">hana::is_empty</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcd"</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-Iterable.html#ga2a05f564f8a7e4afa04fcbc07ad8f394">hana::is_empty</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">""</span>)));</div><div class="line"></div><div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcd"</span>)[hana::size_c<2>] == hana::char_c<'c'>);</div><div class="line"></div><div class="line"> <span class="keyword">auto</span> is_vowel = [](<span class="keyword">auto</span> c) {</div><div class="line"> <span class="keywordflow">return</span> c ^<a class="code" href="group__group-Searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">hana::in</a>^ <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"aeiouy"</span>);</div><div class="line"> };</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-Iterable.html#ga9f1d02c74a6bdc1db260e0d6a8f1ee56">hana::drop_while</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"aioubcd"</span>), is_vowel) == <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"bcd"</span>)</div><div class="line"> );</div><div class="line">}</div></div><!-- fragment --></li>
- <li><code>Searchable</code><br />
- Searching through a string is equivalent to searching through the sequence of its characters. <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="contains_8hpp.html">boost/hana/contains.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="find_8hpp.html">boost/hana/find.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="optional_8hpp.html">boost/hana/optional.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"></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#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(hana::char_c<'c'> ^<a class="code" href="group__group-Searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">hana::in</a>^ <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcde"</span>));</div><div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(!(hana::char_c<'z'> ^<a class="code" href="group__group-Searchable.html#ga0d9456ceda38b6ca664998e79d7c45b7">hana::in</a>^ <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcde"</span>)));</div><div class="line"></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-Searchable.html#ga6b6cdd69942b0fe3bf5254247f9c861e">hana::find</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcxefg"</span>), hana::char_c<'x'>) == hana::just(hana::char_c<'x'>)</div><div class="line"> );</div><div class="line">}</div></div><!-- fragment --></li>
- <li><code>Hashable</code><br />
- The hash of a compile-time string is a type uniquely representing that string. <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="hash_8hpp.html">boost/hana/hash.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="not__equal_8hpp.html">boost/hana/not_equal.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"></div><div class="line"></div><div class="line"><span class="comment">// `hana::hash` returns a type uniquely representing the string. The hash is</span></div><div class="line"><span class="comment">// perfect, meaning no two different strings have the same hash value.</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-Comparable.html#gae33be2e0d5e04f19082f4b7740dfc9cd">hana::not_equal</a>(</div><div class="line"> <a class="code" href="group__group-Hashable.html#ga6e906f44f47b210615491385e5c8a7b5">hana::hash</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcdef"</span>)),</div><div class="line"> <a class="code" href="group__group-Hashable.html#ga6e906f44f47b210615491385e5c8a7b5">hana::hash</a>(<a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcdefg"</span>))</div><div class="line">));</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() { }</div></div><!-- fragment --></li>
- </ol>
- <h2>Conversion to <code>char const*</code> </h2>
- <p>A <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> can be converted to a <code>constexpr</code> null-delimited string of type <code>char const*</code> by using the <code><a class="el" href="structboost_1_1hana_1_1string.html#af21839d798df54bcbe3d552740f3b16b" title="Returns a null-delimited C-style string.">c_str()</a></code> method or <code><a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e" title="Converts an object from one data type to another.">hana::to</a><char const*></code>. This makes it easy to turn a compile-time string into a runtime string. However, note that this conversion is not an embedding, because <code>char const*</code> does not model the same concepts as <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> does. </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 <<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="core_2to_8hpp.html">boost/hana/core/to.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"></div><div class="line"></div><div class="line">constexpr <span class="keyword">auto</span> str = hana::string_c<'h', 'i'>;</div><div class="line"></div><div class="line"><span class="comment">// using c_str()</span></div><div class="line">constexpr <span class="keywordtype">char</span> <span class="keyword">const</span>* s1 = str.c_str();</div><div class="line">static_assert(s1[0] == <span class="charliteral">'h'</span> && s1[1] == <span class="charliteral">'i'</span> && s1[2] == <span class="charliteral">'\0'</span>, <span class="stringliteral">""</span>);</div><div class="line"></div><div class="line"><span class="comment">// using hana::to</span></div><div class="line">constexpr <span class="keywordtype">char</span> <span class="keyword">const</span>* s2 = hana::to<char const*>(str);</div><div class="line">static_assert(s2[0] == <span class="charliteral">'h'</span> && s2[1] == <span class="charliteral">'i'</span> && s2[2] == <span class="charliteral">'\0'</span>, <span class="stringliteral">""</span>);</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() { }</div></div><!-- fragment --><h2>Conversion from any Constant holding a <code>char const*</code> </h2>
- <p>A <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> can be created from any <code>Constant</code> whose underlying value is convertible to a <code>char const*</code> by using <code><a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e" title="Converts an object from one data type to another.">hana::to</a></code>. The contents of the <code>char const*</code> are used to build the content of the <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code>. </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 <<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="core_2to_8hpp.html">boost/hana/core/to.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="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"></div><div class="line"></div><div class="line">constexpr <span class="keywordtype">char</span> <span class="keyword">const</span> hello[] = <span class="stringliteral">"hello"</span>;</div><div class="line"><span class="keyword">auto</span> hello_constant = hana::integral_constant<char const*, hello>{};</div><div class="line"></div><div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(</div><div class="line"> hana::to_string(hello_constant) == hana::string_c<'h', 'e', 'l', 'l', 'o'></div><div class="line">);</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() { }</div></div><!-- fragment --><h2>Rationale for <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> not being a <code>Constant</code> itself </h2>
- <p>The underlying type held by a <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> could be either <code>char const*</code> or some other constexpr-enabled string-like container. In the first case, <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> can not be a <code>Constant</code> because the models of several concepts would not be respected by the underlying type, causing <code>value</code> not to be structure-preserving. Providing an underlying value of constexpr-enabled string-like container type like <code>std::string_view</code> would be great, but that's a bit complicated for the time being. </p>
- </div><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="related"></a>
- Synopsis of associated functions</h2></td></tr>
- <tr class="memitem:a75de1ad7b14dc576a98d759dc3176ae9"><td class="memTemplParams" colspan="2">template<> </td></tr>
- <tr class="memitem:a75de1ad7b14dc576a98d759dc3176ae9"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a75de1ad7b14dc576a98d759dc3176ae9">make< string_tag ></a></td></tr>
- <tr class="memdesc:a75de1ad7b14dc576a98d759dc3176ae9"><td class="mdescLeft"> </td><td class="mdescRight">Create a compile-time <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> from a parameter pack of <code>char</code> <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s. <a href="#a75de1ad7b14dc576a98d759dc3176ae9">More...</a><br /></td></tr>
- <tr class="separator:a75de1ad7b14dc576a98d759dc3176ae9"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:acd99ab02697909eba5eb76caf1ca7a8b"><td class="memItemLeft" align="right" valign="top">constexpr auto </td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#acd99ab02697909eba5eb76caf1ca7a8b">make_string</a> = <a class="el" href="group__group-core.html#ga1d92480f0af1029878e773dafa3e2f60">make</a><<a class="el" href="structboost_1_1hana_1_1string__tag.html">string_tag</a>></td></tr>
- <tr class="memdesc:acd99ab02697909eba5eb76caf1ca7a8b"><td class="mdescLeft"> </td><td class="mdescRight">Alias to <code>make<<a class="el" href="structboost_1_1hana_1_1string__tag.html" title="Tag representing a compile-time string.">string_tag</a>></code>; provided for convenience. <a href="#acd99ab02697909eba5eb76caf1ca7a8b">More...</a><br /></td></tr>
- <tr class="separator:acd99ab02697909eba5eb76caf1ca7a8b"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aa3fb479070239c86673c624a21a845b6"><td class="memItemLeft" align="right" valign="top">constexpr auto </td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#aa3fb479070239c86673c624a21a845b6">to_string</a> = <a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e">to</a><<a class="el" href="structboost_1_1hana_1_1string__tag.html">string_tag</a>></td></tr>
- <tr class="memdesc:aa3fb479070239c86673c624a21a845b6"><td class="mdescLeft"> </td><td class="mdescRight">Equivalent to <code>to<<a class="el" href="structboost_1_1hana_1_1string__tag.html" title="Tag representing a compile-time string.">string_tag</a>></code>; provided for convenience. <a href="#aa3fb479070239c86673c624a21a845b6">More...</a><br /></td></tr>
- <tr class="separator:aa3fb479070239c86673c624a21a845b6"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a810915f5e494decfe47b047a3500c577"><td class="memTemplParams" colspan="2">template<char ... s> </td></tr>
- <tr class="memitem:a810915f5e494decfe47b047a3500c577"><td class="memTemplItemLeft" align="right" valign="top">constexpr <a class="el" href="structboost_1_1hana_1_1string.html">string</a>< implementation_defined > </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a810915f5e494decfe47b047a3500c577">string_c</a> {}</td></tr>
- <tr class="memdesc:a810915f5e494decfe47b047a3500c577"><td class="mdescLeft"> </td><td class="mdescRight">Create a compile-time string from a parameter pack of characters. <a href="#a810915f5e494decfe47b047a3500c577">More...</a><br /></td></tr>
- <tr class="separator:a810915f5e494decfe47b047a3500c577"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a7f15faa77e126e1c2b08a2224ceefb84"><td class="memItemLeft" align="right" valign="top">#define </td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(s)   see documentation</td></tr>
- <tr class="memdesc:a7f15faa77e126e1c2b08a2224ceefb84"><td class="mdescLeft"> </td><td class="mdescRight">Create a compile-time string from a string literal. <a href="#a7f15faa77e126e1c2b08a2224ceefb84">More...</a><br /></td></tr>
- <tr class="separator:a7f15faa77e126e1c2b08a2224ceefb84"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ad77f7afff008c2ce15739ad16a8bf0a8"><td class="memTemplParams" colspan="2">template<typename CharT , CharT ... s> </td></tr>
- <tr class="memitem:ad77f7afff008c2ce15739ad16a8bf0a8"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#ad77f7afff008c2ce15739ad16a8bf0a8">operator""_s</a> ()</td></tr>
- <tr class="memdesc:ad77f7afff008c2ce15739ad16a8bf0a8"><td class="mdescLeft"> </td><td class="mdescRight">Creates a compile-time string from a string literal. <a href="#ad77f7afff008c2ce15739ad16a8bf0a8">More...</a><br /></td></tr>
- <tr class="separator:ad77f7afff008c2ce15739ad16a8bf0a8"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="friends"></a>
- Friends</h2></td></tr>
- <tr class="memitem:a27607958295e6da8a0ba602a2db468f1"><td class="memTemplParams" colspan="2"><a id="a27607958295e6da8a0ba602a2db468f1"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:a27607958295e6da8a0ba602a2db468f1"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a27607958295e6da8a0ba602a2db468f1">operator==</a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:a27607958295e6da8a0ba602a2db468f1"><td class="mdescLeft"> </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>
- <tr class="separator:a27607958295e6da8a0ba602a2db468f1"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a0cae3af55edb3eb05bfa184bda633f7d"><td class="memTemplParams" colspan="2"><a id="a0cae3af55edb3eb05bfa184bda633f7d"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:a0cae3af55edb3eb05bfa184bda633f7d"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a0cae3af55edb3eb05bfa184bda633f7d">operator!=</a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:a0cae3af55edb3eb05bfa184bda633f7d"><td class="mdescLeft"> </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>
- <tr class="separator:a0cae3af55edb3eb05bfa184bda633f7d"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:ada078dcf9e68b8e9a82b33c75dde8457"><td class="memTemplParams" colspan="2"><a id="ada078dcf9e68b8e9a82b33c75dde8457"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:ada078dcf9e68b8e9a82b33c75dde8457"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#ada078dcf9e68b8e9a82b33c75dde8457">operator<</a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:ada078dcf9e68b8e9a82b33c75dde8457"><td class="mdescLeft"> </td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-Orderable.html#gad510011602bdb14686f1c4ec145301c9" title="Returns a Logical representing whether x is less than y.">hana::less</a></code> <br /></td></tr>
- <tr class="separator:ada078dcf9e68b8e9a82b33c75dde8457"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aedd11fddefddbbbb87d3b24c7117528f"><td class="memTemplParams" colspan="2"><a id="aedd11fddefddbbbb87d3b24c7117528f"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:aedd11fddefddbbbb87d3b24c7117528f"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#aedd11fddefddbbbb87d3b24c7117528f">operator></a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:aedd11fddefddbbbb87d3b24c7117528f"><td class="mdescLeft"> </td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-Orderable.html#gaf9a073eafebbe514fb19dff82318f198" title="Returns a Logical representing whether x is greater than y.">hana::greater</a></code> <br /></td></tr>
- <tr class="separator:aedd11fddefddbbbb87d3b24c7117528f"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a53817979990da799e659b2576799a79a"><td class="memTemplParams" colspan="2"><a id="a53817979990da799e659b2576799a79a"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:a53817979990da799e659b2576799a79a"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a53817979990da799e659b2576799a79a">operator<=</a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:a53817979990da799e659b2576799a79a"><td class="mdescLeft"> </td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-Orderable.html#ga9917dd82beb67151bf5657245d37b851" title="Returns a Logical representing whether x is less than or equal to y.">hana::less_equal</a></code> <br /></td></tr>
- <tr class="separator:a53817979990da799e659b2576799a79a"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:aa3f0436b623de5208767751e1e9f7e59"><td class="memTemplParams" colspan="2"><a id="aa3f0436b623de5208767751e1e9f7e59"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:aa3f0436b623de5208767751e1e9f7e59"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#aa3f0436b623de5208767751e1e9f7e59">operator>=</a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:aa3f0436b623de5208767751e1e9f7e59"><td class="mdescLeft"> </td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-Orderable.html#ga6023631e7d0a01e16dc3fa4221fbd703" title="Returns a Logical representing whether x is greater than or equal to y.">hana::greater_equal</a></code> <br /></td></tr>
- <tr class="separator:aa3f0436b623de5208767751e1e9f7e59"><td class="memSeparator" colspan="2"> </td></tr>
- <tr class="memitem:a077af435df78fdb178f98b109c8c4297"><td class="memTemplParams" colspan="2"><a id="a077af435df78fdb178f98b109c8c4297"></a>
- template<typename X , typename Y > </td></tr>
- <tr class="memitem:a077af435df78fdb178f98b109c8c4297"><td class="memTemplItemLeft" align="right" valign="top">constexpr auto </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a077af435df78fdb178f98b109c8c4297">operator+</a> (X &&x, Y &&y)</td></tr>
- <tr class="memdesc:a077af435df78fdb178f98b109c8c4297"><td class="mdescLeft"> </td><td class="mdescRight">Performs concatenation; equivalent to <code><a class="el" href="group__group-Monoid.html#gaeb5d4a1e967e319712f9e4791948896c" title="Associative binary operation on a Monoid.">hana::plus</a></code> <br /></td></tr>
- <tr class="separator:a077af435df78fdb178f98b109c8c4297"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
- Public Member Functions</h2></td></tr>
- <tr class="memitem:a02f56704524481cf919907caf271d2a1"><td class="memTemplParams" colspan="2"><a id="a02f56704524481cf919907caf271d2a1"></a>
- template<typename N > </td></tr>
- <tr class="memitem:a02f56704524481cf919907caf271d2a1"><td class="memTemplItemLeft" align="right" valign="top">decltype(auto) constexpr </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#a02f56704524481cf919907caf271d2a1">operator[]</a> (N &&n)</td></tr>
- <tr class="memdesc:a02f56704524481cf919907caf271d2a1"><td class="mdescLeft"> </td><td class="mdescRight">Equivalent to <code><a class="el" href="group__group-Iterable.html#ga8a484304380eae38f3d9663d98860129" title="Returns the nth element of an iterable.Given an Iterable and an IntegralConstant index,...">hana::at</a></code> <br /></td></tr>
- <tr class="separator:a02f56704524481cf919907caf271d2a1"><td class="memSeparator" colspan="2"> </td></tr>
- </table><table class="memberdecls">
- <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
- Static Public Member Functions</h2></td></tr>
- <tr class="memitem:af21839d798df54bcbe3d552740f3b16b"><td class="memItemLeft" align="right" valign="top"><a id="af21839d798df54bcbe3d552740f3b16b"></a>
- static constexpr char const * </td><td class="memItemRight" valign="bottom"><a class="el" href="structboost_1_1hana_1_1string.html#af21839d798df54bcbe3d552740f3b16b">c_str</a> ()</td></tr>
- <tr class="memdesc:af21839d798df54bcbe3d552740f3b16b"><td class="mdescLeft"> </td><td class="mdescRight">Returns a null-delimited C-style string. <br /></td></tr>
- <tr class="separator:af21839d798df54bcbe3d552740f3b16b"><td class="memSeparator" colspan="2"> </td></tr>
- </table>
- <h2 class="groupheader">Associated functions</h2>
- <a id="a75de1ad7b14dc576a98d759dc3176ae9"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a75de1ad7b14dc576a98d759dc3176ae9">◆ </a></span>make< string_tag ></h2>
- <div class="memitem">
- <div class="memproto">
- <div class="memtemplate">
- template<typename implementation_defined > </div>
- <div class="memtemplate">
- template<> </div>
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">constexpr auto <a class="el" href="group__group-core.html#ga1d92480f0af1029878e773dafa3e2f60">make</a>< <a class="el" href="structboost_1_1hana_1_1string__tag.html">string_tag</a> ></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">related</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <b>Initial value:</b><div class="fragment"><div class="line">= [](<span class="keyword">auto</span>&& ...chars) {</div><div class="line"> <span class="keywordflow">return</span> string<implementation_defined>{};</div><div class="line"> }</div></div><!-- fragment -->
- <p>Create a compile-time <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> from a parameter pack of <code>char</code> <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s. </p>
- <p>Given zero or more <code><a class="el" href="structboost_1_1hana_1_1integral__constant.html" title="Compile-time value of an integral type.">integral_constant</a></code>s of underlying type <code>char</code>, <code>make<<a class="el" href="structboost_1_1hana_1_1string__tag.html" title="Tag representing a compile-time string.">string_tag</a>></code> creates a <code><a class="el" href="structboost_1_1hana_1_1string.html" title="Compile-time string.">hana::string</a></code> containing those characters. This is provided mostly for consistency with the rest of the library, as <code>hana::string_c</code> is more convenient to use in most cases.</p>
- <h2>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="equal_8hpp.html">boost/hana/equal.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="preprocessor">#include <<a class="code" href="tuple_8hpp.html">boost/hana/tuple.hpp</a>></span></div><div class="line"><span class="preprocessor">#include <<a class="code" href="unpack_8hpp.html">boost/hana/unpack.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"></div><div class="line"></div><div class="line">constexpr <span class="keyword">auto</span> vowels = hana::tuple_c<char, 'a', 'e', 'i', 'o', 'u', 'y'>;</div><div class="line">constexpr <span class="keyword">auto</span> str = <a class="code" href="group__group-Foldable.html#ga7b0c23944364ce61136e10b978ae2170">hana::unpack</a>(vowels, hana::make<hana::string_tag>);</div><div class="line"><a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(str == <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"aeiouy"</span>));</div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() { }</div></div><!-- fragment -->
- </div>
- </div>
- <a id="acd99ab02697909eba5eb76caf1ca7a8b"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#acd99ab02697909eba5eb76caf1ca7a8b">◆ </a></span>make_string</h2>
- <div class="memitem">
- <div class="memproto">
- <div class="memtemplate">
- template<typename implementation_defined > </div>
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">constexpr auto make_string = <a class="el" href="group__group-core.html#ga1d92480f0af1029878e773dafa3e2f60">make</a><<a class="el" href="structboost_1_1hana_1_1string__tag.html">string_tag</a>></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">related</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Alias to <code>make<<a class="el" href="structboost_1_1hana_1_1string__tag.html" title="Tag representing a compile-time string.">string_tag</a>></code>; provided for convenience. </p>
- </div>
- </div>
- <a id="aa3fb479070239c86673c624a21a845b6"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#aa3fb479070239c86673c624a21a845b6">◆ </a></span>to_string</h2>
- <div class="memitem">
- <div class="memproto">
- <div class="memtemplate">
- template<typename implementation_defined > </div>
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">constexpr auto to_string = <a class="el" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e">to</a><<a class="el" href="structboost_1_1hana_1_1string__tag.html">string_tag</a>></td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">related</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Equivalent to <code>to<<a class="el" href="structboost_1_1hana_1_1string__tag.html" title="Tag representing a compile-time string.">string_tag</a>></code>; provided for convenience. </p>
- </div>
- </div>
- <a id="a810915f5e494decfe47b047a3500c577"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a810915f5e494decfe47b047a3500c577">◆ </a></span>string_c</h2>
- <div class="memitem">
- <div class="memproto">
- <div class="memtemplate">
- template<typename implementation_defined > </div>
- <div class="memtemplate">
- template<char ... s> </div>
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">constexpr <a class="el" href="structboost_1_1hana_1_1string.html">string</a><implementation_defined> string_c {}</td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">related</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Create a compile-time string from a parameter pack of characters. </p>
- <h2>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="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="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"></div><div class="line"></div><div class="line">constexpr <span class="keyword">auto</span> str = hana::string_c<'a', 'b', 'c', 'd', 'e', 'f'>;</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"></div><div class="line"><span class="keywordtype">int</span> main() { }</div></div><!-- fragment -->
- </div>
- </div>
- <a id="a7f15faa77e126e1c2b08a2224ceefb84"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#a7f15faa77e126e1c2b08a2224ceefb84">◆ </a></span>BOOST_HANA_STRING</h2>
- <div class="memitem">
- <div class="memproto">
- <div class="memtemplate">
- template<typename implementation_defined > </div>
- <table class="mlabels">
- <tr>
- <td class="mlabels-left">
- <table class="memname">
- <tr>
- <td class="memname">#define BOOST_HANA_STRING</td>
- <td>(</td>
- <td class="paramtype"> </td>
- <td class="paramname">s</td><td>)</td>
- <td>   see documentation</td>
- </tr>
- </table>
- </td>
- <td class="mlabels-right">
- <span class="mlabels"><span class="mlabel">related</span></span> </td>
- </tr>
- </table>
- </div><div class="memdoc">
- <p>Create a compile-time string from a string literal. </p>
- <p>This macro is a more convenient alternative to <code>string_c</code> for creating compile-time strings. However, since this macro uses a lambda internally, it can't be used in an unevaluated context, or where a constant expression is expected before C++17.</p>
- <h2>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="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"></div><div class="line"></div><div class="line"><span class="keywordtype">int</span> main() {</div><div class="line"> BOOST_HANA_CONSTEXPR_LAMBDA <span class="keyword">auto</span> str = <a class="code" href="structboost_1_1hana_1_1string.html#a7f15faa77e126e1c2b08a2224ceefb84">BOOST_HANA_STRING</a>(<span class="stringliteral">"abcdef"</span>);</div><div class="line"> <a class="code" href="group__group-assertions.html#ga2c5006540936d9f8880e3a39f4fcc035">BOOST_HANA_CONSTANT_CHECK</a>(str == hana::string_c<'a', 'b', 'c', 'd', 'e', 'f'>);</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">}</div></div><!-- fragment -->
- </div>
- </div>
- <a id="ad77f7afff008c2ce15739ad16a8bf0a8"></a>
- <h2 class="memtitle"><span class="permalink"><a href="#ad77f7afff008c2ce15739ad16a8bf0a8">◆ </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 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">related</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>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 -->
- </div>
- </div>
- </div><!-- contents -->
- </div><!-- doc-content -->
- <!--
- Copyright Louis Dionne 2013-2017
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
- -->
- <!-- boost-no-inspect -->
- <!-- HTML footer for doxygen 1.8.9.1-->
- <!-- start footer part -->
- <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
- <ul>
- <li class="navelem"><b>boost</b></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana.html">hana</a></li><li class="navelem"><a class="el" href="structboost_1_1hana_1_1string.html">string</a></li>
- </ul>
- </div>
- </body>
- </html>
|