add doc: string tupele support, hash support

This commit is contained in:
Bolero-MURAKAMI 2013-09-04 18:37:01 +09:00
parent 4e71ab19c4
commit 794666afac
22 changed files with 1752 additions and 42 deletions

View file

@ -0,0 +1,47 @@
.. _sprout-string-basic_string-hash_value:
###############################################################################
hash_value
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR std::size_t
hash_value(sprout::basic_string<T, N, Traits> const& v);
Returns
========================================
| Equivalent to ``sprout::hash_range(v)``.
Notes
========================================
| ``sprout::to_hash(v)`` is a valid call, because ``hash_value(v)`` ADL callable is defined.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
using type = string<8>;
SPROUT_STATIC_CONSTEXPR auto input = type("homuhomu");
SPROUT_STATIC_CONSTEXPR auto h = sprout::to_hash(input);
static_assert(h, "hash value generated from string.");
Complexity
========================================
| linear in N.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/hash.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,46 @@
.. _sprout-string-basic_string-std-hash:
###############################################################################
std::hash
###############################################################################
Interface
========================================
.. sourcecode:: c++
namespace std {
template<typename T, std::size_t N, typename Traits>
struct hash<sprout::basic_string<T, N, Traits> >;
}
Description
========================================
| Meet the requirements of class template hash.
Member functions
----------------------------------------
======================================== ===============================================================================
function definition
======================================== ===============================================================================
operator() Equivalent to ``sprout::hash_range(v)``.
======================================== ===============================================================================
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
using type = string<8>;
SPROUT_STATIC_CONSTEXPR auto input = type("homuhomu");
SPROUT_STATIC_CONSTEXPR auto h = std::hash<type>()(input);
static_assert(h, "hash value generated from string.");
Header
========================================
| ``sprout/string/hash.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,45 @@
.. _sprout-string-basic_string-std-tuple_element:
###############################################################################
std::tuple_element
###############################################################################
Interface
========================================
.. sourcecode:: c++
namespace std {
template<std::size_t I, typename T, std::size_t N, typename Traits>
struct tuple_element<I, sprout::basic_string<T, N, Traits> >;
}
// syntax
std::tuple_element<I, basic_string<T, N, Traits> >::type
Requires
========================================
| ``I < N``. The program is ill-formed if I is out of bounds.
Value
========================================
| The type T.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <type_traits>
using namespace sprout;
using type = string<8>;
using element_type = std::tuple_element<0, type>::type;
static_assert(std::is_same<element_type, char>::value, "tuple element type of string is char.");
Header
========================================
| ``sprout/string/tuple.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,44 @@
.. _sprout-string-basic_string-std-tuple_size:
###############################################################################
std::tuple_size
###############################################################################
Interface
========================================
.. sourcecode:: c++
namespace std {
template<typename T, std::size_t N, typename Traits>
struct tuple_size<sprout::basic_string<T, N, Traits> >;
}
// syntax
std::tuple_size<basic_string<T, N, Traits> >::value
Return type
========================================
| integral constant expression.
Value
========================================
| N.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
using type = string<8>;
SPROUT_STATIC_CONSTEXPR auto size = std::tuple_size<type>::value;
static_assert(size == 8, "tuple size of string is 8.");
Header
========================================
| ``sprout/string/tuple.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,48 @@
.. _sprout-string-basic_string-swap-global:
###############################################################################
swap
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T, std::size_t N, typename Traits>
inline void
swap(sprout::basic_string<T, N, Traits>& lhs, sprout::basic_string<T, N, Traits>& rhs)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)));
Effects
========================================
| ``lhs.swap(rhs)``.
Throws
========================================
| Nothing unless ``lhs.swap(rhs)`` throws an exception.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");
auto y = string<8>("madocchi");
swap(x, y);
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
Complexity
========================================
| linear in N.
Header
========================================
| ``sprout/string/array.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,61 @@
.. _sprout-string-basic_string-tuple_get:
###############################################################################
tuple_get
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<std::size_t I, typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR T&
tuple_get(sprout::basic_string<T, N, Traits>& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR T const&
tuple_get(sprout::basic_string<T, N, Traits> const& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR T&&
tuple_get(sprout::basic_string<T, N, Traits>&& t) SPROUT_NOEXCEPT;
Requires
========================================
| ``I < N``. The program is ill-formed if I is out of bounds.
Returns
========================================
| A reference to the Ith element of a, where indexing is zero-based.
| or
| A const reference to the Ith element of a, where indexing is zero-based.
| or
| Equivalent to ``return move(tuple_get<I>(t));``
Notes
========================================
| ``sprout::get<I>(t)`` (same as sprout::tuples::get) is a valid call, because ``tuple_get<I>(t)`` ADL callable is defined.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = string<8>("homuhomu");
static_assert(sprout::get<4>(input) == 'h', "an element at position 4 is h.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/string/tuple.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -6,13 +6,17 @@ Sprout.String
.. toctree::
:hidden:
basic_string/swap-global
basic_string/std-tuple_size
basic_string/std-tuple_element
basic_string/tuple_get
basic_string/std-hash
basic_string/hash_value
Description
========================================
Character traits
****************************************
Classes
----------------------------------------
======================================== ===============================================================================
@ -22,9 +26,6 @@ class
======================================== ===============================================================================
String classes
****************************************
Classes
----------------------------------------
============================================================ ===============================================================================

View file

@ -0,0 +1,177 @@
<!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/html; charset=utf-8" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43764535-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>hash_value &mdash; Sprout 1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" />
<link rel="prev" title="std::hash" href="std-hash.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="std-hash.html" title="std::hash"
accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">hash_value</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#returns">Returns</a></li>
<li><a class="reference internal" href="#notes">Notes</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="std-hash.html"
title="previous chapter">std::hash</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/basic_string/hash_value.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="hash-value">
<h1>hash_value<a class="headerlink" href="#hash-value" title="Permalink to this headline"></a></h1>
<div class="section" id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span>
<span class="n">hash_value</span><span class="p">(</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="k">const</span><span class="o">&amp;</span> <span class="n">v</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="returns">
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">sprout::hash_range(v)</span></tt>.</div>
</div>
</div>
<div class="section" id="notes">
<h2>Notes<a class="headerlink" href="#notes" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout::to_hash(v)</span></tt> is a valid call, because <tt class="docutils literal"><span class="pre">hash_value(v)</span></tt> ADL callable is defined.</div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &lt;sprout/string.hpp&gt;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
<span class="k">using</span> <span class="n">type</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">;</span>
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input</span> <span class="o">=</span> <span class="n">type</span><span class="p">(</span><span class="s">&quot;homuhomu&quot;</span><span class="p">);</span>
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">h</span> <span class="o">=</span> <span class="n">sprout</span><span class="o">::</span><span class="n">to_hash</span><span class="p">(</span><span class="n">input</span><span class="p">);</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="s">&quot;hash value generated from string.&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="complexity">
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">linear in N.</div>
<div class="line">Recursive function invocations in <em>O(logN)</em> (logarithmic) depth.</div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/hash.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="std-hash.html" title="std::hash"
>previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" >Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Bolero MURAKAMI.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View file

@ -0,0 +1,195 @@
<!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/html; charset=utf-8" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43764535-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>std::hash &mdash; Sprout 1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" />
<link rel="next" title="hash_value" href="hash_value.html" />
<link rel="prev" title="tuple_get" href="tuple_get.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="hash_value.html" title="hash_value"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="tuple_get.html" title="tuple_get"
accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">std::hash</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#description">Description</a><ul>
<li><a class="reference internal" href="#member-functions">Member functions</a></li>
</ul>
</li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="tuple_get.html"
title="previous chapter">tuple_get</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="hash_value.html"
title="next chapter">hash_value</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/basic_string/std-hash.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="std-hash">
<h1>std::hash<a class="headerlink" href="#std-hash" title="Permalink to this headline"></a></h1>
<div class="section" id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">namespace</span> <span class="n">std</span> <span class="p">{</span>
<span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="k">struct</span> <span class="n">hash</span><span class="o">&lt;</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</div>
<div class="section" id="description">
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">Meet the requirements of class template hash.</div>
</div>
<div class="section" id="member-functions">
<h3>Member functions<a class="headerlink" href="#member-functions" title="Permalink to this headline"></a></h3>
<table border="1" class="docutils">
<colgroup>
<col width="34%" />
<col width="66%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">function</th>
<th class="head">definition</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>operator()</td>
<td>Equivalent to <tt class="docutils literal"><span class="pre">sprout::hash_range(v)</span></tt>.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &lt;sprout/string.hpp&gt;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
<span class="k">using</span> <span class="n">type</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">;</span>
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input</span> <span class="o">=</span> <span class="n">type</span><span class="p">(</span><span class="s">&quot;homuhomu&quot;</span><span class="p">);</span>
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">h</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">hash</span><span class="o">&lt;</span><span class="n">type</span><span class="o">&gt;</span><span class="p">()(</span><span class="n">input</span><span class="p">);</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">h</span><span class="p">,</span> <span class="s">&quot;hash value generated from string.&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/hash.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="hash_value.html" title="hash_value"
>next</a> |</li>
<li class="right" >
<a href="tuple_get.html" title="tuple_get"
>previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" >Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Bolero MURAKAMI.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View file

@ -0,0 +1,183 @@
<!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/html; charset=utf-8" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43764535-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>std::tuple_element &mdash; Sprout 1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" />
<link rel="next" title="tuple_get" href="tuple_get.html" />
<link rel="prev" title="std::tuple_size" href="std-tuple_size.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="tuple_get.html" title="tuple_get"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="std-tuple_size.html" title="std::tuple_size"
accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">std::tuple_element</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#requires">Requires</a></li>
<li><a class="reference internal" href="#value">Value</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="std-tuple_size.html"
title="previous chapter">std::tuple_size</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="tuple_get.html"
title="next chapter">tuple_get</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/basic_string/std-tuple_element.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="std-tuple-element">
<h1>std::tuple_element<a class="headerlink" href="#std-tuple-element" title="Permalink to this headline"></a></h1>
<div class="section" id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">namespace</span> <span class="n">std</span> <span class="p">{</span>
<span class="k">template</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">I</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="k">struct</span> <span class="n">tuple_element</span><span class="o">&lt;</span><span class="n">I</span><span class="p">,</span> <span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">;</span>
<span class="p">}</span>
<span class="c1">// syntax</span>
<span class="n">std</span><span class="o">::</span><span class="n">tuple_element</span><span class="o">&lt;</span><span class="n">I</span><span class="p">,</span> <span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="o">&gt;::</span><span class="n">type</span>
</pre></div>
</div>
</div>
<div class="section" id="requires">
<h2>Requires<a class="headerlink" href="#requires" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">I</span> <span class="pre">&lt;</span> <span class="pre">N</span></tt>. The program is ill-formed if I is out of bounds.</div>
</div>
</div>
<div class="section" id="value">
<h2>Value<a class="headerlink" href="#value" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">The type T.</div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &lt;sprout/string.hpp&gt;</span>
<span class="cp">#include &lt;type_traits&gt;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
<span class="k">using</span> <span class="n">type</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">;</span>
<span class="k">using</span> <span class="n">element_type</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple_element</span><span class="o">&lt;</span><span class="mi">0</span><span class="p">,</span> <span class="n">type</span><span class="o">&gt;::</span><span class="n">type</span><span class="p">;</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">is_same</span><span class="o">&lt;</span><span class="n">element_type</span><span class="p">,</span> <span class="kt">char</span><span class="o">&gt;::</span><span class="n">value</span><span class="p">,</span> <span class="s">&quot;tuple element type of string is char.&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="tuple_get.html" title="tuple_get"
>next</a> |</li>
<li class="right" >
<a href="std-tuple_size.html" title="std::tuple_size"
>previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" >Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Bolero MURAKAMI.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View file

@ -0,0 +1,182 @@
<!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/html; charset=utf-8" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43764535-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>std::tuple_size &mdash; Sprout 1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" />
<link rel="next" title="std::tuple_element" href="std-tuple_element.html" />
<link rel="prev" title="swap" href="swap-global.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="std-tuple_element.html" title="std::tuple_element"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="swap-global.html" title="swap"
accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">std::tuple_size</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#return-type">Return type</a></li>
<li><a class="reference internal" href="#value">Value</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="swap-global.html"
title="previous chapter">swap</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="std-tuple_element.html"
title="next chapter">std::tuple_element</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/basic_string/std-tuple_size.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="std-tuple-size">
<h1>std::tuple_size<a class="headerlink" href="#std-tuple-size" title="Permalink to this headline"></a></h1>
<div class="section" id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">namespace</span> <span class="n">std</span> <span class="p">{</span>
<span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="k">struct</span> <span class="n">tuple_size</span><span class="o">&lt;</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="o">&gt;</span><span class="p">;</span>
<span class="p">}</span>
<span class="c1">// syntax</span>
<span class="n">std</span><span class="o">::</span><span class="n">tuple_size</span><span class="o">&lt;</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="o">&gt;::</span><span class="n">value</span>
</pre></div>
</div>
</div>
<div class="section" id="return-type">
<h2>Return type<a class="headerlink" href="#return-type" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">integral constant expression.</div>
</div>
</div>
<div class="section" id="value">
<h2>Value<a class="headerlink" href="#value" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">N.</div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &lt;sprout/string.hpp&gt;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
<span class="k">using</span> <span class="n">type</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">;</span>
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">size</span> <span class="o">=</span> <span class="n">std</span><span class="o">::</span><span class="n">tuple_size</span><span class="o">&lt;</span><span class="n">type</span><span class="o">&gt;::</span><span class="n">value</span><span class="p">;</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">size</span> <span class="o">==</span> <span class="mi">8</span><span class="p">,</span> <span class="s">&quot;tuple size of string is 8.&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="std-tuple_element.html" title="std::tuple_element"
>next</a> |</li>
<li class="right" >
<a href="swap-global.html" title="swap"
>previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" >Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Bolero MURAKAMI.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View file

@ -0,0 +1,188 @@
<!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/html; charset=utf-8" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43764535-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>swap &mdash; Sprout 1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" />
<link rel="next" title="std::tuple_size" href="std-tuple_size.html" />
<link rel="prev" title="Sprout.String" href="../index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="std-tuple_size.html" title="std::tuple_size"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../index.html" title="Sprout.String"
accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">swap</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#effects">Effects</a></li>
<li><a class="reference internal" href="#throws">Throws</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="../index.html"
title="previous chapter">Sprout.String</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="std-tuple_size.html"
title="next chapter">std::tuple_size</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/basic_string/swap-global.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="swap">
<h1>swap<a class="headerlink" href="#swap" title="Permalink to this headline"></a></h1>
<div class="section" id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="kr">inline</span> <span class="kt">void</span>
<span class="n">swap</span><span class="p">(</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;&amp;</span> <span class="n">lhs</span><span class="p">,</span> <span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;&amp;</span> <span class="n">rhs</span><span class="p">)</span>
<span class="n">SPROUT_NOEXCEPT_EXPR</span><span class="p">(</span><span class="n">SPROUT_NOEXCEPT_EXPR</span><span class="p">(</span><span class="n">lhs</span><span class="p">.</span><span class="n">swap</span><span class="p">(</span><span class="n">rhs</span><span class="p">)));</span>
</pre></div>
</div>
</div>
<div class="section" id="effects">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">lhs.swap(rhs)</span></tt>.</div>
</div>
</div>
<div class="section" id="throws">
<h2>Throws<a class="headerlink" href="#throws" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">Nothing unless <tt class="docutils literal"><span class="pre">lhs.swap(rhs)</span></tt> throws an exception.</div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &lt;sprout/string.hpp&gt;</span>
<span class="cp">#include &lt;sprout/assert.hpp&gt;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
<span class="k">auto</span> <span class="n">x</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">(</span><span class="s">&quot;homuhomu&quot;</span><span class="p">);</span>
<span class="k">auto</span> <span class="n">y</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">(</span><span class="s">&quot;madocchi&quot;</span><span class="p">);</span>
<span class="n">swap</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">);</span>
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span> <span class="o">==</span> <span class="s">&quot;madocchi&quot;</span> <span class="o">&amp;&amp;</span> <span class="n">y</span> <span class="o">==</span> <span class="s">&quot;homuhomu&quot;</span><span class="p">,</span> <span class="s">&quot;each element are swapped.&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="complexity">
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">linear in N.</div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/array.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="std-tuple_size.html" title="std::tuple_size"
>next</a> |</li>
<li class="right" >
<a href="../index.html" title="Sprout.String"
>previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" >Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Bolero MURAKAMI.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View file

@ -0,0 +1,203 @@
<!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/html; charset=utf-8" />
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-43764535-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<title>tuple_get &mdash; Sprout 1.0 documentation</title>
<link rel="stylesheet" href="../../../_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../../',
VERSION: '1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../../_static/jquery.js"></script>
<script type="text/javascript" src="../../../_static/underscore.js"></script>
<script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" />
<link rel="next" title="std::hash" href="std-hash.html" />
<link rel="prev" title="std::tuple_element" href="std-tuple_element.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="std-hash.html" title="std::hash"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="std-tuple_element.html" title="std::tuple_element"
accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../../../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">tuple_get</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#requires">Requires</a></li>
<li><a class="reference internal" href="#returns">Returns</a></li>
<li><a class="reference internal" href="#notes">Notes</a></li>
<li><a class="reference internal" href="#examples">Examples</a></li>
<li><a class="reference internal" href="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="std-tuple_element.html"
title="previous chapter">std::tuple_element</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="std-hash.html"
title="next chapter">std::hash</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/basic_string/tuple_get.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="tuple-get">
<h1>tuple_get<a class="headerlink" href="#tuple-get" title="Permalink to this headline"></a></h1>
<div class="section" id="interface">
<h2>Interface<a class="headerlink" href="#interface" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="k">template</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">I</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">T</span><span class="o">&amp;</span>
<span class="n">tuple_get</span><span class="p">(</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;&amp;</span> <span class="n">t</span><span class="p">)</span> <span class="n">SPROUT_NOEXCEPT</span><span class="p">;</span>
<span class="k">template</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">I</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">T</span> <span class="k">const</span><span class="o">&amp;</span>
<span class="n">tuple_get</span><span class="p">(</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;</span> <span class="k">const</span><span class="o">&amp;</span> <span class="n">t</span><span class="p">)</span> <span class="n">SPROUT_NOEXCEPT</span><span class="p">;</span>
<span class="k">template</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">I</span><span class="p">,</span> <span class="k">typename</span> <span class="n">T</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">size_t</span> <span class="n">N</span><span class="p">,</span> <span class="k">typename</span> <span class="n">Traits</span><span class="o">&gt;</span>
<span class="kr">inline</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">T</span><span class="o">&amp;&amp;</span>
<span class="n">tuple_get</span><span class="p">(</span><span class="n">sprout</span><span class="o">::</span><span class="n">basic_string</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</span><span class="p">,</span> <span class="n">Traits</span><span class="o">&gt;&amp;&amp;</span> <span class="n">t</span><span class="p">)</span> <span class="n">SPROUT_NOEXCEPT</span><span class="p">;</span>
</pre></div>
</div>
</div>
<div class="section" id="requires">
<h2>Requires<a class="headerlink" href="#requires" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">I</span> <span class="pre">&lt;</span> <span class="pre">N</span></tt>. The program is ill-formed if I is out of bounds.</div>
</div>
</div>
<div class="section" id="returns">
<h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">A reference to the Ith element of a, where indexing is zero-based.</div>
<div class="line">or</div>
<div class="line">A const reference to the Ith element of a, where indexing is zero-based.</div>
<div class="line">or</div>
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">return</span> <span class="pre">move(tuple_get&lt;I&gt;(t));</span></tt></div>
</div>
</div>
<div class="section" id="notes">
<h2>Notes<a class="headerlink" href="#notes" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout::get&lt;I&gt;(t)</span></tt> (same as sprout::tuples::get) is a valid call, because <tt class="docutils literal"><span class="pre">tuple_get&lt;I&gt;(t)</span></tt> ADL callable is defined.</div>
</div>
</div>
<div class="section" id="examples">
<h2>Examples<a class="headerlink" href="#examples" title="Permalink to this headline"></a></h2>
<div class="highlight-c++"><div class="highlight"><pre><span class="cp">#include &lt;sprout/string.hpp&gt;</span>
<span class="k">using</span> <span class="k">namespace</span> <span class="n">sprout</span><span class="p">;</span>
<span class="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">input</span> <span class="o">=</span> <span class="n">string</span><span class="o">&lt;</span><span class="mi">8</span><span class="o">&gt;</span><span class="p">(</span><span class="s">&quot;homuhomu&quot;</span><span class="p">);</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">sprout</span><span class="o">::</span><span class="n">get</span><span class="o">&lt;</span><span class="mi">4</span><span class="o">&gt;</span><span class="p">(</span><span class="n">input</span><span class="p">)</span> <span class="o">==</span> <span class="sc">&#39;h&#39;</span><span class="p">,</span> <span class="s">&quot;an element at position 4 is h.&quot;</span><span class="p">);</span>
</pre></div>
</div>
</div>
<div class="section" id="complexity">
<h2>Complexity<a class="headerlink" href="#complexity" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">Recursive function invocations in <em>O(1)</em> (constant) depth.</div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line"><tt class="docutils literal"><span class="pre">sprout/string/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="std-hash.html" title="std::hash"
>next</a> |</li>
<li class="right" >
<a href="std-tuple_element.html" title="std::tuple_element"
>previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../../index.html" >Libraries</a> &raquo;</li>
<li><a href="../index.html" >Sprout.String</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2013, Bolero MURAKAMI.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>

View file

@ -38,6 +38,7 @@
<script type="text/javascript" src="../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../index.html" />
<link rel="up" title="Libraries" href="../index.html" />
<link rel="next" title="swap" href="basic_string/swap-global.html" />
<link rel="prev" title="clamp" href="../algorithm/clamp.html" />
</head>
<body>
@ -47,6 +48,9 @@
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="basic_string/swap-global.html" title="swap"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../algorithm/clamp.html" title="clamp"
accesskey="P">previous</a> |</li>
@ -60,12 +64,8 @@
<ul>
<li><a class="reference internal" href="#">Sprout.String</a><ul>
<li><a class="reference internal" href="#description">Description</a><ul>
<li><a class="reference internal" href="#character-traits">Character traits</a><ul>
<li><a class="reference internal" href="#classes">Classes</a></li>
</ul>
</li>
<li><a class="reference internal" href="#string-classes">String classes</a><ul>
<li><a class="reference internal" href="#id2">Classes</a></li>
<li><a class="reference internal" href="#character-traits">Character traits</a></li>
<li><a class="reference internal" href="#string-classes">String classes</a></li>
<li><a class="reference internal" href="#non-member-functions">Non-member functions</a><ul>
<li><a class="reference internal" href="#specialized-algorithms">specialized algorithms</a></li>
<li><a class="reference internal" href="#concatenations">concatenations</a></li>
@ -79,8 +79,6 @@
<li><a class="reference internal" href="#hash-support">Hash support</a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#header">Header</a></li>
</ul>
</li>
@ -89,6 +87,9 @@
<h4>Previous topic</h4>
<p class="topless"><a href="../algorithm/clamp.html"
title="previous chapter">clamp</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="basic_string/swap-global.html"
title="next chapter">swap</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/libs/string/index.txt"
@ -123,8 +124,6 @@
<h2>Description<a class="headerlink" href="#description" title="Permalink to this headline"></a></h2>
<div class="section" id="character-traits">
<h3>Character traits<a class="headerlink" href="#character-traits" title="Permalink to this headline"></a></h3>
<div class="section" id="classes">
<h4>Classes<a class="headerlink" href="#classes" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="34%" />
@ -142,11 +141,8 @@
</tbody>
</table>
</div>
</div>
<div class="section" id="string-classes">
<h3>String classes<a class="headerlink" href="#string-classes" title="Permalink to this headline"></a></h3>
<div class="section" id="id2">
<h4>Classes<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -177,9 +173,9 @@
</table>
</div>
<div class="section" id="non-member-functions">
<h4>Non-member functions<a class="headerlink" href="#non-member-functions" title="Permalink to this headline"></a></h4>
<h3>Non-member functions<a class="headerlink" href="#non-member-functions" title="Permalink to this headline"></a></h3>
<div class="section" id="specialized-algorithms">
<h5>specialized algorithms<a class="headerlink" href="#specialized-algorithms" title="Permalink to this headline"></a></h5>
<h4>specialized algorithms<a class="headerlink" href="#specialized-algorithms" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -191,14 +187,14 @@
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">swap</span></tt></td>
<tr class="row-even"><td><a class="reference internal" href="basic_string/swap-global.html"><em>swap</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="concatenations">
<h5>concatenations<a class="headerlink" href="#concatenations" title="Permalink to this headline"></a></h5>
<h4>concatenations<a class="headerlink" href="#concatenations" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -217,7 +213,7 @@
</table>
</div>
<div class="section" id="comparisons">
<h5>comparisons<a class="headerlink" href="#comparisons" title="Permalink to this headline"></a></h5>
<h4>comparisons<a class="headerlink" href="#comparisons" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -251,7 +247,7 @@
</table>
</div>
<div class="section" id="inserters-and-extractors">
<h5>inserters and extractors<a class="headerlink" href="#inserters-and-extractors" title="Permalink to this headline"></a></h5>
<h4>inserters and extractors<a class="headerlink" href="#inserters-and-extractors" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -273,7 +269,7 @@
</table>
</div>
<div class="section" id="numeric-conversions">
<h5>numeric conversions<a class="headerlink" href="#numeric-conversions" title="Permalink to this headline"></a></h5>
<h4>numeric conversions<a class="headerlink" href="#numeric-conversions" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="50%" />
@ -373,7 +369,7 @@
</table>
</div>
<div class="section" id="string-generators">
<h5>string generators<a class="headerlink" href="#string-generators" title="Permalink to this headline"></a></h5>
<h4>string generators<a class="headerlink" href="#string-generators" title="Permalink to this headline"></a></h4>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -405,7 +401,7 @@
</div>
</div>
<div class="section" id="tuple-interface">
<h4>Tuple interface<a class="headerlink" href="#tuple-interface" title="Permalink to this headline"></a></h4>
<h3>Tuple interface<a class="headerlink" href="#tuple-interface" title="Permalink to this headline"></a></h3>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -417,10 +413,10 @@
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">std::tuple_size</span></tt></td>
<tr class="row-even"><td><a class="reference internal" href="basic_string/std-tuple_size.html"><em>std::tuple_size</em></a></td>
<td>&nbsp;</td>
</tr>
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">std::tuple_element</span></tt></td>
<tr class="row-odd"><td><a class="reference internal" href="basic_string/std-tuple_element.html"><em>std::tuple_element</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
@ -436,14 +432,14 @@
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">tuple_get</span></tt></td>
<tr class="row-even"><td><a class="reference internal" href="basic_string/tuple_get.html"><em>tuple_get</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>
<div class="section" id="hash-support">
<h4>Hash support<a class="headerlink" href="#hash-support" title="Permalink to this headline"></a></h4>
<h3>Hash support<a class="headerlink" href="#hash-support" title="Permalink to this headline"></a></h3>
<table border="1" class="docutils">
<colgroup>
<col width="43%" />
@ -455,7 +451,7 @@
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">std::hash</span></tt></td>
<tr class="row-even"><td><a class="reference internal" href="basic_string/std-hash.html"><em>std::hash</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
@ -471,14 +467,13 @@
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">hash_value</span></tt></td>
<tr class="row-even"><td><a class="reference internal" href="basic_string/hash_value.html"><em>hash_value</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="header">
<h2>Header<a class="headerlink" href="#header" title="Permalink to this headline"></a></h2>
<p><tt class="docutils literal"><span class="pre">sprout/string.hpp</span></tt></p>
@ -497,6 +492,9 @@
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="basic_string/swap-global.html" title="swap"
>next</a> |</li>
<li class="right" >
<a href="../algorithm/clamp.html" title="clamp"
>previous</a> |</li>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,47 @@
.. _sprout-string-basic_string-hash_value:
###############################################################################
hash_value
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR std::size_t
hash_value(sprout::basic_string<T, N, Traits> const& v);
Returns
========================================
| Equivalent to ``sprout::hash_range(v)``.
Notes
========================================
| ``sprout::to_hash(v)`` is a valid call, because ``hash_value(v)`` ADL callable is defined.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
using type = string<8>;
SPROUT_STATIC_CONSTEXPR auto input = type("homuhomu");
SPROUT_STATIC_CONSTEXPR auto h = sprout::to_hash(input);
static_assert(h, "hash value generated from string.");
Complexity
========================================
| linear in N.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/hash.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,46 @@
.. _sprout-string-basic_string-std-hash:
###############################################################################
std::hash
###############################################################################
Interface
========================================
.. sourcecode:: c++
namespace std {
template<typename T, std::size_t N, typename Traits>
struct hash<sprout::basic_string<T, N, Traits> >;
}
Description
========================================
| Meet the requirements of class template hash.
Member functions
----------------------------------------
======================================== ===============================================================================
function definition
======================================== ===============================================================================
operator() Equivalent to ``sprout::hash_range(v)``.
======================================== ===============================================================================
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
using type = string<8>;
SPROUT_STATIC_CONSTEXPR auto input = type("homuhomu");
SPROUT_STATIC_CONSTEXPR auto h = std::hash<type>()(input);
static_assert(h, "hash value generated from string.");
Header
========================================
| ``sprout/string/hash.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,45 @@
.. _sprout-string-basic_string-std-tuple_element:
###############################################################################
std::tuple_element
###############################################################################
Interface
========================================
.. sourcecode:: c++
namespace std {
template<std::size_t I, typename T, std::size_t N, typename Traits>
struct tuple_element<I, sprout::basic_string<T, N, Traits> >;
}
// syntax
std::tuple_element<I, basic_string<T, N, Traits> >::type
Requires
========================================
| ``I < N``. The program is ill-formed if I is out of bounds.
Value
========================================
| The type T.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <type_traits>
using namespace sprout;
using type = string<8>;
using element_type = std::tuple_element<0, type>::type;
static_assert(std::is_same<element_type, char>::value, "tuple element type of string is char.");
Header
========================================
| ``sprout/string/tuple.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,44 @@
.. _sprout-string-basic_string-std-tuple_size:
###############################################################################
std::tuple_size
###############################################################################
Interface
========================================
.. sourcecode:: c++
namespace std {
template<typename T, std::size_t N, typename Traits>
struct tuple_size<sprout::basic_string<T, N, Traits> >;
}
// syntax
std::tuple_size<basic_string<T, N, Traits> >::value
Return type
========================================
| integral constant expression.
Value
========================================
| N.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
using type = string<8>;
SPROUT_STATIC_CONSTEXPR auto size = std::tuple_size<type>::value;
static_assert(size == 8, "tuple size of string is 8.");
Header
========================================
| ``sprout/string/tuple.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,48 @@
.. _sprout-string-basic_string-swap-global:
###############################################################################
swap
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T, std::size_t N, typename Traits>
inline void
swap(sprout::basic_string<T, N, Traits>& lhs, sprout::basic_string<T, N, Traits>& rhs)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)));
Effects
========================================
| ``lhs.swap(rhs)``.
Throws
========================================
| Nothing unless ``lhs.swap(rhs)`` throws an exception.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");
auto y = string<8>("madocchi");
swap(x, y);
SPROUT_ASSERT_MSG(x == "madocchi" && y == "homuhomu", "each element are swapped.");
Complexity
========================================
| linear in N.
Header
========================================
| ``sprout/string/array.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,61 @@
.. _sprout-string-basic_string-tuple_get:
###############################################################################
tuple_get
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<std::size_t I, typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR T&
tuple_get(sprout::basic_string<T, N, Traits>& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR T const&
tuple_get(sprout::basic_string<T, N, Traits> const& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N, typename Traits>
inline SPROUT_CONSTEXPR T&&
tuple_get(sprout::basic_string<T, N, Traits>&& t) SPROUT_NOEXCEPT;
Requires
========================================
| ``I < N``. The program is ill-formed if I is out of bounds.
Returns
========================================
| A reference to the Ith element of a, where indexing is zero-based.
| or
| A const reference to the Ith element of a, where indexing is zero-based.
| or
| Equivalent to ``return move(tuple_get<I>(t));``
Notes
========================================
| ``sprout::get<I>(t)`` (same as sprout::tuples::get) is a valid call, because ``tuple_get<I>(t)`` ADL callable is defined.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = string<8>("homuhomu");
static_assert(sprout::get<4>(input) == 'h', "an element at position 4 is h.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/string/tuple.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -6,13 +6,17 @@ Sprout.String
.. toctree::
:hidden:
basic_string/swap-global
basic_string/std-tuple_size
basic_string/std-tuple_element
basic_string/tuple_get
basic_string/std-hash
basic_string/hash_value
Description
========================================
Character traits
****************************************
Classes
----------------------------------------
======================================== ===============================================================================
@ -22,9 +26,6 @@ class
======================================== ===============================================================================
String classes
****************************************
Classes
----------------------------------------
============================================================ ===============================================================================