add doc: array tuple support, hash support

This commit is contained in:
Bolero-MURAKAMI 2013-08-31 19:32:55 +09:00
parent bf12021ae6
commit a2580d4926
24 changed files with 1442 additions and 21 deletions

View file

@ -3,6 +3,8 @@
Sprout C++ Libraries
###############################################################################
Contents:
.. toctree::
:maxdepth: 1
@ -21,7 +23,6 @@ Library Documentation
*******************************************************************************
| The starting point for the documentation of individual libraries is the :doc:`Libraries page <./libs/index>`, which gives a brief description of each library and links to its documentation.
|
.. _sprout-project:
*******************************************************************************
@ -56,7 +57,7 @@ Author
*******************************************************************************
| Bolero MURAKAMI `(Mail) <contact-lib@boleros.x0.com>`_
| `[Website] <http://bolero-murakami.github.io/>`_ `[Twitter] <https://twitter.com/bolero_murakami>`_ `[Facebook] <http://www.facebook.com/genya.murakami>`_ `[Blog] <http://d.hatena.ne.jp/boleros/>`_ `[Github] <https://github.com/bolero-MURAKAMI>`_ `[SlideShare] <http://www.slideshare.net/GenyaMurakami>`_
| `Website <http://bolero-murakami.github.io/>`_ | `Twitter <https://twitter.com/bolero_murakami>`_ | `Facebook <http://www.facebook.com/genya.murakami>`_ | `Blog <http://d.hatena.ne.jp/boleros/>`_ | `Github <https://github.com/bolero-MURAKAMI>`_ | `SlideShare <http://www.slideshare.net/GenyaMurakami>`_
.. _sprout-copyrights:
*******************************************************************************

View file

@ -0,0 +1,47 @@
.. _sprout-array-array-hash_value:
###############################################################################
hash_value
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T, std::size_t N>
inline SPROUT_CONSTEXPR std::size_t
hash_value(sprout::array<T, N> 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/array.hpp>
using namespace sprout;
using type = array<int, 10>;
SPROUT_STATIC_CONSTEXPR auto input = type{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto h = sprout::to_hash(input);
static_assert(h, "hash value generated from array.");
Complexity
========================================
| linear in N.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/array/tuple.hpp``
| Convenience header: ``sprout/array.hpp``

View file

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

View file

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

View file

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

View file

@ -0,0 +1,61 @@
.. _sprout-array-array-tuple_get:
###############################################################################
tuple_get
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<std::size_t I, typename T, std::size_t N>
inline SPROUT_CONSTEXPR T&
tuple_get(sprout::array<T, N>& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N>
inline SPROUT_CONSTEXPR T const&
tuple_get(sprout::array<T, N> const& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N>
inline SPROUT_CONSTEXPR T&&
tuple_get(sprout::array<T, N>&& 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/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(sprout::get<5>(input) == 6, "an element at position 5 is 6.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/tuple.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -17,6 +17,11 @@ Sprout.Array
to_array
make_array
make_common_array
array/std-tuple_size
array/std-tuple_element
array/tuple_get
array/std-hash
array/hash_value
Description
========================================
@ -86,6 +91,12 @@ function
Hash support
----------------------------------------
============================================================ ===============================================================================
class
============================================================ ===============================================================================
:doc:`std::hash <./array/std-hash>`
============================================================ ===============================================================================
======================================== ===============================================================================
function
======================================== ===============================================================================

View file

@ -88,6 +88,7 @@
<div class="section" id="sprout-c-libraries">
<h1>Sprout C++ Libraries<a class="headerlink" href="#sprout-c-libraries" title="Permalink to this headline"></a></h1>
<p>Contents:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="libs/index.html">Libraries</a></li>
@ -103,7 +104,6 @@
<h2>Library Documentation<a class="headerlink" href="#library-documentation" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">The starting point for the documentation of individual libraries is the <a class="reference internal" href="libs/index.html"><em>Libraries page</em></a>, which gives a brief description of each library and links to its documentation.</div>
<div class="line"><br /></div>
</div>
</div>
<div class="section" id="project-page">
@ -133,7 +133,7 @@
<h2>Author<a class="headerlink" href="#author" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">Bolero MURAKAMI <a class="reference external" href="mailto:contact-lib&#37;&#52;&#48;boleros&#46;x0&#46;com">(Mail)</a></div>
<div class="line"><a class="reference external" href="http://bolero-murakami.github.io/">[Website]</a> <a class="reference external" href="https://twitter.com/bolero_murakami">[Twitter]</a> <a class="reference external" href="http://www.facebook.com/genya.murakami">[Facebook]</a> <a class="reference external" href="http://d.hatena.ne.jp/boleros/">[Blog]</a> <a class="reference external" href="https://github.com/bolero-MURAKAMI">[Github]</a> <a class="reference external" href="http://www.slideshare.net/GenyaMurakami">[SlideShare]</a></div>
<div class="line"><a class="reference external" href="http://bolero-murakami.github.io/">Website</a> | <a class="reference external" href="https://twitter.com/bolero_murakami">Twitter</a> | <a class="reference external" href="http://www.facebook.com/genya.murakami">Facebook</a> | <a class="reference external" href="http://d.hatena.ne.jp/boleros/">Blog</a> | <a class="reference external" href="https://github.com/bolero-MURAKAMI">Github</a> | <a class="reference external" href="http://www.slideshare.net/GenyaMurakami">SlideShare</a></div>
</div>
</div>
<div class="section" id="copyrights">

View file

@ -28,7 +28,7 @@
<link rel="top" title="Sprout 1.0 documentation" href="../../index.html" />
<link rel="up" title="Libraries" href="../index.html" />
<link rel="next" title="all_of" href="all_of.html" />
<link rel="prev" title="make_common_array" href="../array/make_common_array.html" />
<link rel="prev" title="hash_value" href="../array/array/hash_value.html" />
</head>
<body>
<div class="related">
@ -41,7 +41,7 @@
<a href="all_of.html" title="all_of"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../array/make_common_array.html" title="make_common_array"
<a href="../array/array/hash_value.html" title="hash_value"
accesskey="P">previous</a> |</li>
<li><a href="../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../index.html" accesskey="U">Libraries</a> &raquo;</li>
@ -67,8 +67,8 @@
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="../array/make_common_array.html"
title="previous chapter">make_common_array</a></p>
<p class="topless"><a href="../array/array/hash_value.html"
title="previous chapter">hash_value</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="all_of.html"
title="next chapter">all_of</a></p>
@ -362,7 +362,7 @@
<a href="all_of.html" title="all_of"
>next</a> |</li>
<li class="right" >
<a href="../array/make_common_array.html" title="make_common_array"
<a href="../array/array/hash_value.html" title="hash_value"
>previous</a> |</li>
<li><a href="../../index.html">Sprout 1.0 documentation</a> &raquo;</li>
<li><a href="../index.html" >Libraries</a> &raquo;</li>

View file

@ -0,0 +1,176 @@
<!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" />
<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.Array" href="../index.html" />
<link rel="next" title="Sprout.Algorithm" href="../../algorithm/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="../../algorithm/index.html" title="Sprout.Algorithm"
accesskey="N">next</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.Array</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>
<h4>Next topic</h4>
<p class="topless"><a href="../../algorithm/index.html"
title="next chapter">Sprout.Algorithm</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/array/array/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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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/array.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">array</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</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="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</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 array.&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/array/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/array.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="../../algorithm/index.html" title="Sprout.Algorithm"
>next</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.Array</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,184 @@
<!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" />
<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.Array" 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.Array</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/array/array/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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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/array.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">array</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</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="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</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 array.&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/array/hash.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/array.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.Array</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,172 @@
<!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" />
<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.Array" 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.Array</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/array/array/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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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/array.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">array</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</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">int</span><span class="o">&gt;::</span><span class="n">value</span><span class="p">,</span> <span class="s">&quot;tuple element type of array is int.&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/array/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/array.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.Array</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,171 @@
<!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" />
<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.Array" href="../index.html" />
<link rel="next" title="std::tuple_element" href="std-tuple_element.html" />
<link rel="prev" title="make_common_array" href="../make_common_array.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="../make_common_array.html" title="make_common_array"
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.Array</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="../make_common_array.html"
title="previous chapter">make_common_array</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/array/array/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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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/array.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">array</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</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">10</span><span class="p">,</span> <span class="s">&quot;tuple size of array is 10.&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/array/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/array.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="../make_common_array.html" title="make_common_array"
>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.Array</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,192 @@
<!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" />
<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.Array" 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.Array</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/array/array/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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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="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">array</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span> <span class="n">N</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/array.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">array</span><span class="o">&lt;</span><span class="kt">int</span><span class="p">,</span> <span class="mi">10</span><span class="o">&gt;</span><span class="p">{{</span><span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="mi">4</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="mi">9</span><span class="p">,</span> <span class="mi">10</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">5</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="mi">6</span><span class="p">,</span> <span class="s">&quot;an element at position 5 is 6.&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/array/tuple.hpp</span></tt></div>
<div class="line">Convenience header: <tt class="docutils literal"><span class="pre">sprout/array.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.Array</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

@ -220,10 +220,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="array/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="array/std-tuple_element.html"><em>std::tuple_element</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
@ -239,7 +239,7 @@
</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="array/tuple_get.html"><em>tuple_get</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
@ -249,6 +249,22 @@
<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%" />
<col width="57%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">class</th>
<th class="head">&nbsp;</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference internal" href="array/std-hash.html"><em>std::hash</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>
</table>
<table border="1" class="docutils">
<colgroup>
<col width="34%" />
<col width="66%" />
</colgroup>
@ -258,7 +274,7 @@
</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="array/hash_value.html"><em>hash_value</em></a></td>
<td>&nbsp;</td>
</tr>
</tbody>

View file

@ -27,7 +27,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="Sprout.Array" href="index.html" />
<link rel="next" title="Sprout.Algorithm" href="../algorithm/index.html" />
<link rel="next" title="std::tuple_size" href="array/std-tuple_size.html" />
<link rel="prev" title="make_array" href="make_array.html" />
</head>
<body>
@ -38,7 +38,7 @@
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../algorithm/index.html" title="Sprout.Algorithm"
<a href="array/std-tuple_size.html" title="std::tuple_size"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="make_array.html" title="make_array"
@ -67,8 +67,8 @@
<p class="topless"><a href="make_array.html"
title="previous chapter">make_array</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="../algorithm/index.html"
title="next chapter">Sprout.Algorithm</a></p>
<p class="topless"><a href="array/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/array/make_common_array.txt"
@ -154,7 +154,7 @@
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../algorithm/index.html" title="Sprout.Algorithm"
<a href="array/std-tuple_size.html" title="std::tuple_size"
>next</a> |</li>
<li class="right" >
<a href="make_array.html" title="make_array"

File diff suppressed because one or more lines are too long

View file

@ -3,6 +3,8 @@
Sprout C++ Libraries
###############################################################################
Contents:
.. toctree::
:maxdepth: 1
@ -21,7 +23,6 @@ Library Documentation
*******************************************************************************
| The starting point for the documentation of individual libraries is the :doc:`Libraries page <./libs/index>`, which gives a brief description of each library and links to its documentation.
|
.. _sprout-project:
*******************************************************************************
@ -56,7 +57,7 @@ Author
*******************************************************************************
| Bolero MURAKAMI `(Mail) <contact-lib@boleros.x0.com>`_
| `[Website] <http://bolero-murakami.github.io/>`_ `[Twitter] <https://twitter.com/bolero_murakami>`_ `[Facebook] <http://www.facebook.com/genya.murakami>`_ `[Blog] <http://d.hatena.ne.jp/boleros/>`_ `[Github] <https://github.com/bolero-MURAKAMI>`_ `[SlideShare] <http://www.slideshare.net/GenyaMurakami>`_
| `Website <http://bolero-murakami.github.io/>`_ | `Twitter <https://twitter.com/bolero_murakami>`_ | `Facebook <http://www.facebook.com/genya.murakami>`_ | `Blog <http://d.hatena.ne.jp/boleros/>`_ | `Github <https://github.com/bolero-MURAKAMI>`_ | `SlideShare <http://www.slideshare.net/GenyaMurakami>`_
.. _sprout-copyrights:
*******************************************************************************

View file

@ -0,0 +1,47 @@
.. _sprout-array-array-hash_value:
###############################################################################
hash_value
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename T, std::size_t N>
inline SPROUT_CONSTEXPR std::size_t
hash_value(sprout::array<T, N> 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/array.hpp>
using namespace sprout;
using type = array<int, 10>;
SPROUT_STATIC_CONSTEXPR auto input = type{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
SPROUT_STATIC_CONSTEXPR auto h = sprout::to_hash(input);
static_assert(h, "hash value generated from array.");
Complexity
========================================
| linear in N.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/array/tuple.hpp``
| Convenience header: ``sprout/array.hpp``

View file

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

View file

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

View file

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

View file

@ -0,0 +1,61 @@
.. _sprout-array-array-tuple_get:
###############################################################################
tuple_get
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<std::size_t I, typename T, std::size_t N>
inline SPROUT_CONSTEXPR T&
tuple_get(sprout::array<T, N>& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N>
inline SPROUT_CONSTEXPR T const&
tuple_get(sprout::array<T, N> const& t) SPROUT_NOEXCEPT;
template<std::size_t I, typename T, std::size_t N>
inline SPROUT_CONSTEXPR T&&
tuple_get(sprout::array<T, N>&& 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/array.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}};
static_assert(sprout::get<5>(input) == 6, "an element at position 5 is 6.");
Complexity
========================================
| Recursive function invocations in *O(1)* (constant) depth.
Header
========================================
| ``sprout/array/tuple.hpp``
| Convenience header: ``sprout/array.hpp``

View file

@ -17,6 +17,11 @@ Sprout.Array
to_array
make_array
make_common_array
array/std-tuple_size
array/std-tuple_element
array/tuple_get
array/std-hash
array/hash_value
Description
========================================
@ -86,6 +91,12 @@ function
Hash support
----------------------------------------
============================================================ ===============================================================================
class
============================================================ ===============================================================================
:doc:`std::hash <./array/std-hash>`
============================================================ ===============================================================================
======================================== ===============================================================================
function
======================================== ===============================================================================