add doc: char_traits string operations (for iterator)

This commit is contained in:
Bolero-MURAKAMI 2013-09-05 17:16:56 +09:00
parent 0ef068c92b
commit dd0c5f4dbb
47 changed files with 1722 additions and 60 deletions

View file

@ -0,0 +1,40 @@
.. _sprout-string-char_traits-assign-iterator:
###############################################################################
assign
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename OutputIterator>
static OutputIterator assign(OutputIterator s, std::size_t n, char_type a);
Effects
========================================
| For each i in [0,n) performs ``assign(s[i], c)``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");;
char_traits<char>::assign(x.begin(), 8, 'M');
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,49 @@
.. _sprout-string-char_traits-compare-iterator:
###############################################################################
compare
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n);
template<typename ConstInputIterator1, typename ConstInputIterator2>
static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n);
Returns
========================================
| If for each i in [0,n), ``eq(s1[i], s2[i])`` is true, return zero.
| Otherwise, if for some j in [0,n), ``lt(s1[j], s2[j])`` is true and for each i in [0,j) ``eq(s1[i], s2[i])`` is true, return a negative value.
| Otherwise, return a positive value.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::compare(x.begin(), y.begin(), 8);
static_assert(result < 0, "x is less than y.");
Complexity
========================================
| linear.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,46 @@
.. _sprout-string-char_traits-copy-iterator:
###############################################################################
copy
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator copy(OutputIterator s1, ConstInputIterator s2, std::size_t n);
Pre-condition
========================================
| s2 not in [s1,s1+n).
Effects
========================================
| For each i in [0,n) performs ``assign(s1[i], s2[i])``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");;
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
char_traits<char>::copy(x.begin(), y.begin(), 8);
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -9,6 +9,11 @@ Interface
static char_type* copy(char_type* s1, char_type const* s2, std::size_t n); static char_type* copy(char_type* s1, char_type const* s2, std::size_t n);
Pre-condition
========================================
| s2 not in [s1,s1+n).
Effects Effects
======================================== ========================================

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::eof()``. | Equivalent to ``std::char_traits<Char>::eof()``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR bool eq(char_type c1, char_type c2) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR bool eq(char_type c1, char_type c2) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::eq(c1, c2)``. | Equivalent to ``std::char_traits<Char>::eq(c1, c2)``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::eq_int_type(c1, c2)``. | Equivalent to ``std::char_traits<Char>::eq_int_type(c1, c2)``.

View file

@ -0,0 +1,46 @@
.. _sprout-string-char_traits-find-iterator:
###############################################################################
find
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR ConstInputIterator find(ConstInputIterator s, std::size_t n, char_type const& a);
Returns
========================================
| The smallest q in [s,s+n) such that ``eq(*q, a)`` is true, ``s + n`` otherwise.
Remarks
========================================
| Pointer version returns 0 when it not found, but this function returns ``s + n``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/iterator.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::find(x.begin(), 8, 'm');
static_assert(sprout::distance(x, result) == 2, "a found position is 2.");
Complexity
========================================
| linear.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -20,6 +20,12 @@ char_traits
to_int_type to_int_type
eq_int_type eq_int_type
eof eof
compare-iterator
length-iterator
find-iterator
move-iterator
copy-iterator
assign-iterator
Interface Interface
======================================== ========================================
@ -59,8 +65,8 @@ Interface
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n); static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n);
template<typename ConstInputIterator> template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n); static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n);
template<typename ConstIterator1, typename ConstIterator2> template<typename ConstInputIterator1, typename ConstInputIterator2>
static SPROUT_CONSTEXPR int compare(ConstIterator1 s1, ConstIterator2 s2, std::size_t n); static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n);
template<typename ConstInputIterator> template<typename ConstInputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s); static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s);
template<typename ConstInputIterator> template<typename ConstInputIterator>
@ -137,7 +143,7 @@ string operations (for iterator)
function function
======================================== =============================================================================== ======================================== ===============================================================================
:doc:`compare <./compare-iterator>` :doc:`compare <./compare-iterator>`
:doc:`eqlength<./length-iterator>` :doc:`length<./length-iterator>`
:doc:`find <./find-iterator>` :doc:`find <./find-iterator>`
:doc:`move <./move-iterator>` :doc:`move <./move-iterator>`
:doc:`copy <./copy-iterator>` :doc:`copy <./copy-iterator>`

View file

@ -0,0 +1,40 @@
.. _sprout-string-char_traits-length-iterator:
###############################################################################
length
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s);
Returns
========================================
| The smallest i such that ``eq(s[i], char_type())`` is true.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::length(x.begin());
static_assert(result == 8, "length of x is 8.");
Complexity
========================================
| linear.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR bool lt(char_type c1, char_type c2) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR bool lt(char_type c1, char_type c2) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::lt(c1, c2)``. | Equivalent to ``std::char_traits<Char>::lt(c1, c2)``.

View file

@ -0,0 +1,42 @@
.. _sprout-string-char_traits-move-iterator:
###############################################################################
move
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator move(OutputIterator s1, ConstInputIterator s2, std::size_t n);
Effects
========================================
| For each i in [0,n) performs ``assign(s1[i], p2[i])``.
| Copies correctly even where the ranges [s2,s2+n) and [s1,s1+n) overlap.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");;
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
char_traits<char>::move(x.begin(), y.begin(), 8);
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::not_eof(c)``. | Equivalent to ``std::char_traits<Char>::not_eof(c)``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::to_char_type(c)``. | Equivalent to ``std::char_traits<Char>::to_char_type(c)``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::to_int_type(c)``. | Equivalent to ``std::char_traits<Char>::to_int_type(c)``.

View file

@ -39,7 +39,7 @@
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" /> <link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="Sprout.String" href="../index.html" /> <link rel="up" title="Sprout.String" href="../index.html" />
<link rel="next" title="operator+" href="operator-plus.html" /> <link rel="next" title="operator+" href="operator-plus.html" />
<link rel="prev" title="eof" href="../char_traits/eof.html" /> <link rel="prev" title="assign" href="../char_traits/assign-iterator.html" />
</head> </head>
<body> <body>
<div class="related"> <div class="related">
@ -52,7 +52,7 @@
<a href="operator-plus.html" title="operator+" <a href="operator-plus.html" title="operator+"
accesskey="N">next</a> |</li> accesskey="N">next</a> |</li>
<li class="right" > <li class="right" >
<a href="../char_traits/eof.html" title="eof" <a href="../char_traits/assign-iterator.html" title="assign"
accesskey="P">previous</a> |</li> accesskey="P">previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</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" >Libraries</a> &raquo;</li>
@ -75,8 +75,8 @@
</ul> </ul>
<h4>Previous topic</h4> <h4>Previous topic</h4>
<p class="topless"><a href="../char_traits/eof.html" <p class="topless"><a href="../char_traits/assign-iterator.html"
title="previous chapter">eof</a></p> title="previous chapter">assign</a></p>
<h4>Next topic</h4> <h4>Next topic</h4>
<p class="topless"><a href="operator-plus.html" <p class="topless"><a href="operator-plus.html"
title="next chapter">operator+</a></p> title="next chapter">operator+</a></p>
@ -173,7 +173,7 @@
<a href="operator-plus.html" title="operator+" <a href="operator-plus.html" title="operator+"
>next</a> |</li> >next</a> |</li>
<li class="right" > <li class="right" >
<a href="../char_traits/eof.html" title="eof" <a href="../char_traits/assign-iterator.html" title="assign"
>previous</a> |</li> >previous</a> |</li>
<li><a href="../../../index.html">Sprout 1.0 documentation</a> &raquo;</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" >Libraries</a> &raquo;</li>

View file

@ -0,0 +1,180 @@
<!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>assign &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="char_traits" href="index.html" />
<link rel="next" title="swap" href="../basic_string/swap-global.html" />
<link rel="prev" title="copy" href="copy-iterator.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="../basic_string/swap-global.html" title="swap"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="copy-iterator.html" title="copy"
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" >Sprout.String</a> &raquo;</li>
<li><a href="index.html" accesskey="U">char_traits</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="#">assign</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="#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="copy-iterator.html"
title="previous chapter">copy</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/char_traits/assign-iterator.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="assign">
<h1>assign<a class="headerlink" href="#assign" 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">OutputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">OutputIterator</span> <span class="n">assign</span><span class="p">(</span><span class="n">OutputIterator</span> <span class="n">s</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="n">char_type</span> <span class="n">a</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">For each i in [0,n) performs <tt class="docutils literal"><span class="pre">assign(s[i],</span> <span class="pre">c)</span></tt>.</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="n">char_traits</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;::</span><span class="n">assign</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">,</span> <span class="sc">&#39;M&#39;</span><span class="p">);</span>
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="sc">&#39;M&#39;</span><span class="p">,</span> <span class="s">&quot;x is filled by M.&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.</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/char_traits.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="../basic_string/swap-global.html" title="swap"
>next</a> |</li>
<li class="right" >
<a href="copy-iterator.html" title="copy"
>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>
<li><a href="index.html" >char_traits</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,189 @@
<!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>compare &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="char_traits" href="index.html" />
<link rel="next" title="length" href="length-iterator.html" />
<link rel="prev" title="eof" href="eof.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="length-iterator.html" title="length"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="eof.html" title="eof"
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" >Sprout.String</a> &raquo;</li>
<li><a href="index.html" accesskey="U">char_traits</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="#">compare</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="#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="eof.html"
title="previous chapter">eof</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="length-iterator.html"
title="next chapter">length</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/char_traits/compare-iterator.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="compare">
<h1>compare<a class="headerlink" href="#compare" 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">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">char_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator</span> <span class="n">s2</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">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s1</span><span class="p">,</span> <span class="n">char_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s2</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">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ConstInputIterator2</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">ConstInputIterator1</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator2</span> <span class="n">s2</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>
</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">If for each i in [0,n), <tt class="docutils literal"><span class="pre">eq(s1[i],</span> <span class="pre">s2[i])</span></tt> is true, return zero.</div>
<div class="line">Otherwise, if for some j in [0,n), <tt class="docutils literal"><span class="pre">lt(s1[j],</span> <span class="pre">s2[j])</span></tt> is true and for each i in [0,j) <tt class="docutils literal"><span class="pre">eq(s1[i],</span> <span class="pre">s2[i])</span></tt> is true, return a negative value.</div>
<div class="line">Otherwise, return a positive value.</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">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="n">SPROUT_STATIC_CONSTEXPR</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">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">char_traits</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;::</span><span class="n">compare</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">,</span> <span class="s">&quot;x is less than y.&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.</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/char_traits.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="length-iterator.html" title="length"
>next</a> |</li>
<li class="right" >
<a href="eof.html" title="eof"
>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>
<li><a href="index.html" >char_traits</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>copy &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="char_traits" href="index.html" />
<link rel="next" title="assign" href="assign-iterator.html" />
<link rel="prev" title="move" href="move-iterator.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="assign-iterator.html" title="assign"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="move-iterator.html" title="move"
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" >Sprout.String</a> &raquo;</li>
<li><a href="index.html" accesskey="U">char_traits</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="#">copy</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#pre-condition">Pre-condition</a></li>
<li><a class="reference internal" href="#effects">Effects</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="move-iterator.html"
title="previous chapter">move</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="assign-iterator.html"
title="next chapter">assign</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/char_traits/copy-iterator.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="copy">
<h1>copy<a class="headerlink" href="#copy" 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">OutputIterator</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">OutputIterator</span> <span class="n">copy</span><span class="p">(</span><span class="n">OutputIterator</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator</span> <span class="n">s2</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>
</pre></div>
</div>
</div>
<div class="section" id="pre-condition">
<h2>Pre-condition<a class="headerlink" href="#pre-condition" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">s2 not in [s1,s1+n).</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">For each i in [0,n) performs <tt class="docutils literal"><span class="pre">assign(s1[i],</span> <span class="pre">s2[i])</span></tt>.</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="n">SPROUT_STATIC_CONSTEXPR</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">char_traits</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;::</span><span class="n">copy</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&quot;y is copied to x.&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.</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/char_traits.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="assign-iterator.html" title="assign"
>next</a> |</li>
<li class="right" >
<a href="move-iterator.html" title="move"
>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>
<li><a href="index.html" >char_traits</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

@ -66,6 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">copy</a><ul> <li><a class="reference internal" href="#">copy</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <li><a class="reference internal" href="#interface">Interface</a></li>
<li><a class="reference internal" href="#pre-condition">Pre-condition</a></li>
<li><a class="reference internal" href="#effects">Effects</a></li> <li><a class="reference internal" href="#effects">Effects</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
@ -114,6 +115,12 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="pre-condition">
<h2>Pre-condition<a class="headerlink" href="#pre-condition" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">s2 not in [s1,s1+n).</div>
</div>
</div>
<div class="section" id="effects"> <div class="section" id="effects">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">

View file

@ -38,7 +38,7 @@
<script type="text/javascript" src="../../../_static/doctools.js"></script> <script type="text/javascript" src="../../../_static/doctools.js"></script>
<link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" /> <link rel="top" title="Sprout 1.0 documentation" href="../../../index.html" />
<link rel="up" title="char_traits" href="index.html" /> <link rel="up" title="char_traits" href="index.html" />
<link rel="next" title="swap" href="../basic_string/swap-global.html" /> <link rel="next" title="compare" href="compare-iterator.html" />
<link rel="prev" title="eq_int_type" href="eq_int_type.html" /> <link rel="prev" title="eq_int_type" href="eq_int_type.html" />
</head> </head>
<body> <body>
@ -49,7 +49,7 @@
<a href="../../../genindex.html" title="General Index" <a href="../../../genindex.html" title="General Index"
accesskey="I">index</a></li> accesskey="I">index</a></li>
<li class="right" > <li class="right" >
<a href="../basic_string/swap-global.html" title="swap" <a href="compare-iterator.html" title="compare"
accesskey="N">next</a> |</li> accesskey="N">next</a> |</li>
<li class="right" > <li class="right" >
<a href="eq_int_type.html" title="eq_int_type" <a href="eq_int_type.html" title="eq_int_type"
@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">eof</a><ul> <li><a class="reference internal" href="#">eof</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -78,8 +78,8 @@
<p class="topless"><a href="eq_int_type.html" <p class="topless"><a href="eq_int_type.html"
title="previous chapter">eq_int_type</a></p> title="previous chapter">eq_int_type</a></p>
<h4>Next topic</h4> <h4>Next topic</h4>
<p class="topless"><a href="../basic_string/swap-global.html" <p class="topless"><a href="compare-iterator.html"
title="next chapter">swap</a></p> title="next chapter">compare</a></p>
<h3>This Page</h3> <h3>This Page</h3>
<ul class="this-page-menu"> <ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/char_traits/eof.txt" <li><a href="../../../_sources/libs/string/char_traits/eof.txt"
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::eof()</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::eof()</span></tt>.</div>
</div> </div>
@ -160,7 +160,7 @@
<a href="../../../genindex.html" title="General Index" <a href="../../../genindex.html" title="General Index"
>index</a></li> >index</a></li>
<li class="right" > <li class="right" >
<a href="../basic_string/swap-global.html" title="swap" <a href="compare-iterator.html" title="compare"
>next</a> |</li> >next</a> |</li>
<li class="right" > <li class="right" >
<a href="eq_int_type.html" title="eq_int_type" <a href="eq_int_type.html" title="eq_int_type"

View file

@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">eq</a><ul> <li><a class="reference internal" href="#">eq</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::eq(c1,</span> <span class="pre">c2)</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::eq(c1,</span> <span class="pre">c2)</span></tt>.</div>
</div> </div>

View file

@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">eq_int_type</a><ul> <li><a class="reference internal" href="#">eq_int_type</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::eq_int_type(c1,</span> <span class="pre">c2)</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::eq_int_type(c1,</span> <span class="pre">c2)</span></tt>.</div>
</div> </div>

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>find &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="char_traits" href="index.html" />
<link rel="next" title="move" href="move-iterator.html" />
<link rel="prev" title="length" href="length-iterator.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="move-iterator.html" title="move"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="length-iterator.html" title="length"
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" >Sprout.String</a> &raquo;</li>
<li><a href="index.html" accesskey="U">char_traits</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="#">find</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="#remarks">Remarks</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="length-iterator.html"
title="previous chapter">length</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="move-iterator.html"
title="next chapter">move</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/char_traits/find-iterator.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="find">
<h1>find<a class="headerlink" href="#find" 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">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="n">ConstInputIterator</span> <span class="n">find</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s</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="n">char_type</span> <span class="k">const</span><span class="o">&amp;</span> <span class="n">a</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">The smallest q in [s,s+n) such that <tt class="docutils literal"><span class="pre">eq(*q,</span> <span class="pre">a)</span></tt> is true, <tt class="docutils literal"><span class="pre">s</span> <span class="pre">+</span> <span class="pre">n</span></tt> otherwise.</div>
</div>
</div>
<div class="section" id="remarks">
<h2>Remarks<a class="headerlink" href="#remarks" title="Permalink to this headline"></a></h2>
<div class="line-block">
<div class="line">Pointer version returns 0 when it not found, but this function returns <tt class="docutils literal"><span class="pre">s</span> <span class="pre">+</span> <span class="pre">n</span></tt>.</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/iterator.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">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="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">char_traits</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;::</span><span class="n">find</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">,</span> <span class="sc">&#39;m&#39;</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">distance</span><span class="p">(</span><span class="n">x</span><span class="p">,</span> <span class="n">result</span><span class="p">)</span> <span class="o">==</span> <span class="mi">2</span><span class="p">,</span> <span class="s">&quot;a found position is 2.&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.</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/char_traits.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="move-iterator.html" title="move"
>next</a> |</li>
<li class="right" >
<a href="length-iterator.html" title="length"
>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>
<li><a href="index.html" >char_traits</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

@ -153,8 +153,8 @@
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">char_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator</span> <span class="n">s2</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">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">char_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator</span> <span class="n">s2</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">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s1</span><span class="p">,</span> <span class="n">char_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s2</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">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s1</span><span class="p">,</span> <span class="n">char_type</span> <span class="k">const</span><span class="o">*</span> <span class="n">s2</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">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ConstIterator2</span><span class="o">&gt;</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator1</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ConstInputIterator2</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">ConstIterator1</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstIterator2</span> <span class="n">s2</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">static</span> <span class="n">SPROUT_CONSTEXPR</span> <span class="kt">int</span> <span class="n">compare</span><span class="p">(</span><span class="n">ConstInputIterator1</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator2</span> <span class="n">s2</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">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</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">length</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s</span><span class="p">);</span> <span class="k">static</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">length</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s</span><span class="p">);</span>
<span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span> <span class="k">template</span><span class="o">&lt;</span><span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span>
@ -314,22 +314,22 @@
</tr> </tr>
</thead> </thead>
<tbody valign="top"> <tbody valign="top">
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">compare</span></tt></td> <tr class="row-even"><td><a class="reference internal" href="compare-iterator.html"><em>compare</em></a></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">eqlength</span></tt></td> <tr class="row-odd"><td><a class="reference internal" href="length-iterator.html"><em>length</em></a></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">find</span></tt></td> <tr class="row-even"><td><a class="reference internal" href="find-iterator.html"><em>find</em></a></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">move</span></tt></td> <tr class="row-odd"><td><a class="reference internal" href="move-iterator.html"><em>move</em></a></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr class="row-even"><td><tt class="xref doc docutils literal"><span class="pre">copy</span></tt></td> <tr class="row-even"><td><a class="reference internal" href="copy-iterator.html"><em>copy</em></a></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
<tr class="row-odd"><td><tt class="xref doc docutils literal"><span class="pre">assign</span></tt></td> <tr class="row-odd"><td><a class="reference internal" href="assign-iterator.html"><em>assign</em></a></td>
<td>&nbsp;</td> <td>&nbsp;</td>
</tr> </tr>
</tbody> </tbody>

View file

@ -0,0 +1,180 @@
<!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>length &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="char_traits" href="index.html" />
<link rel="next" title="find" href="find-iterator.html" />
<link rel="prev" title="compare" href="compare-iterator.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="find-iterator.html" title="find"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="compare-iterator.html" title="compare"
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" >Sprout.String</a> &raquo;</li>
<li><a href="index.html" accesskey="U">char_traits</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="#">length</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="#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="compare-iterator.html"
title="previous chapter">compare</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="find-iterator.html"
title="next chapter">find</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/char_traits/length-iterator.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="length">
<h1>length<a class="headerlink" href="#length" 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">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</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">length</span><span class="p">(</span><span class="n">ConstInputIterator</span> <span class="n">s</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">The smallest i such that <tt class="docutils literal"><span class="pre">eq(s[i],</span> <span class="pre">char_type())</span></tt> is true.</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">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="n">SPROUT_STATIC_CONSTEXPR</span> <span class="k">auto</span> <span class="n">result</span> <span class="o">=</span> <span class="n">char_traits</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;::</span><span class="n">length</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">());</span>
<span class="n">static_assert</span><span class="p">(</span><span class="n">result</span> <span class="o">==</span> <span class="mi">8</span><span class="p">,</span> <span class="s">&quot;length of x is 8.&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.</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/char_traits.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="find-iterator.html" title="find"
>next</a> |</li>
<li class="right" >
<a href="compare-iterator.html" title="compare"
>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>
<li><a href="index.html" >char_traits</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

@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">lt</a><ul> <li><a class="reference internal" href="#">lt</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::lt(c1,</span> <span class="pre">c2)</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::lt(c1,</span> <span class="pre">c2)</span></tt>.</div>
</div> </div>

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>move &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="char_traits" href="index.html" />
<link rel="next" title="copy" href="copy-iterator.html" />
<link rel="prev" title="find" href="find-iterator.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="copy-iterator.html" title="copy"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="find-iterator.html" title="find"
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" >Sprout.String</a> &raquo;</li>
<li><a href="index.html" accesskey="U">char_traits</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="#">move</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="#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="find-iterator.html"
title="previous chapter">find</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="copy-iterator.html"
title="next chapter">copy</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/libs/string/char_traits/move-iterator.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="move">
<h1>move<a class="headerlink" href="#move" 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">OutputIterator</span><span class="p">,</span> <span class="k">typename</span> <span class="n">ConstInputIterator</span><span class="o">&gt;</span>
<span class="k">static</span> <span class="n">OutputIterator</span> <span class="n">move</span><span class="p">(</span><span class="n">OutputIterator</span> <span class="n">s1</span><span class="p">,</span> <span class="n">ConstInputIterator</span> <span class="n">s2</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>
</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">For each i in [0,n) performs <tt class="docutils literal"><span class="pre">assign(s1[i],</span> <span class="pre">p2[i])</span></tt>.</div>
<div class="line">Copies correctly even where the ranges [s2,s2+n) and [s1,s1+n) overlap.</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="n">SPROUT_STATIC_CONSTEXPR</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">char_traits</span><span class="o">&lt;</span><span class="kt">char</span><span class="o">&gt;::</span><span class="n">move</span><span class="p">(</span><span class="n">x</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="n">y</span><span class="p">.</span><span class="n">begin</span><span class="p">(),</span> <span class="mi">8</span><span class="p">);</span>
<span class="n">SPROUT_ASSERT_MSG</span><span class="p">(</span><span class="n">x</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="n">y</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="s">&quot;y is copied to x.&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.</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/char_traits.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="copy-iterator.html" title="copy"
>next</a> |</li>
<li class="right" >
<a href="find-iterator.html" title="find"
>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>
<li><a href="index.html" >char_traits</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

@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">not_eof</a><ul> <li><a class="reference internal" href="#">not_eof</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::not_eof(c)</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::not_eof(c)</span></tt>.</div>
</div> </div>

View file

@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">to_char_type</a><ul> <li><a class="reference internal" href="#">to_char_type</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::to_char_type(c)</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::to_char_type(c)</span></tt>.</div>
</div> </div>

View file

@ -66,7 +66,7 @@
<ul> <ul>
<li><a class="reference internal" href="#">to_int_type</a><ul> <li><a class="reference internal" href="#">to_int_type</a><ul>
<li><a class="reference internal" href="#interface">Interface</a></li> <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="#returns">Returns</a></li>
<li><a class="reference internal" href="#examples">Examples</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="#complexity">Complexity</a></li>
<li><a class="reference internal" href="#header">Header</a></li> <li><a class="reference internal" href="#header">Header</a></li>
@ -114,8 +114,8 @@
</pre></div> </pre></div>
</div> </div>
</div> </div>
<div class="section" id="effects"> <div class="section" id="returns">
<h2>Effects<a class="headerlink" href="#effects" title="Permalink to this headline"></a></h2> <h2>Returns<a class="headerlink" href="#returns" title="Permalink to this headline"></a></h2>
<div class="line-block"> <div class="line-block">
<div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::to_int_type(c)</span></tt>.</div> <div class="line">Equivalent to <tt class="docutils literal"><span class="pre">std::char_traits&lt;Char&gt;::to_int_type(c)</span></tt>.</div>
</div> </div>

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,40 @@
.. _sprout-string-char_traits-assign-iterator:
###############################################################################
assign
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename OutputIterator>
static OutputIterator assign(OutputIterator s, std::size_t n, char_type a);
Effects
========================================
| For each i in [0,n) performs ``assign(s[i], c)``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");;
char_traits<char>::assign(x.begin(), 8, 'M');
SPROUT_ASSERT_MSG(x[0] == 'M', "x is filled by M.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,49 @@
.. _sprout-string-char_traits-compare-iterator:
###############################################################################
compare
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n);
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n);
template<typename ConstInputIterator1, typename ConstInputIterator2>
static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n);
Returns
========================================
| If for each i in [0,n), ``eq(s1[i], s2[i])`` is true, return zero.
| Otherwise, if for some j in [0,n), ``lt(s1[j], s2[j])`` is true and for each i in [0,j) ``eq(s1[i], s2[i])`` is true, return a negative value.
| Otherwise, return a positive value.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::compare(x.begin(), y.begin(), 8);
static_assert(result < 0, "x is less than y.");
Complexity
========================================
| linear.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -0,0 +1,46 @@
.. _sprout-string-char_traits-copy-iterator:
###############################################################################
copy
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator copy(OutputIterator s1, ConstInputIterator s2, std::size_t n);
Pre-condition
========================================
| s2 not in [s1,s1+n).
Effects
========================================
| For each i in [0,n) performs ``assign(s1[i], s2[i])``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");;
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
char_traits<char>::copy(x.begin(), y.begin(), 8);
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -9,6 +9,11 @@ Interface
static char_type* copy(char_type* s1, char_type const* s2, std::size_t n); static char_type* copy(char_type* s1, char_type const* s2, std::size_t n);
Pre-condition
========================================
| s2 not in [s1,s1+n).
Effects Effects
======================================== ========================================

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR int_type eof() SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::eof()``. | Equivalent to ``std::char_traits<Char>::eof()``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR bool eq(char_type c1, char_type c2) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR bool eq(char_type c1, char_type c2) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::eq(c1, c2)``. | Equivalent to ``std::char_traits<Char>::eq(c1, c2)``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR bool eq_int_type(int_type c1, int_type c2) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::eq_int_type(c1, c2)``. | Equivalent to ``std::char_traits<Char>::eq_int_type(c1, c2)``.

View file

@ -0,0 +1,46 @@
.. _sprout-string-char_traits-find-iterator:
###############################################################################
find
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR ConstInputIterator find(ConstInputIterator s, std::size_t n, char_type const& a);
Returns
========================================
| The smallest q in [s,s+n) such that ``eq(*q, a)`` is true, ``s + n`` otherwise.
Remarks
========================================
| Pointer version returns 0 when it not found, but this function returns ``s + n``.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/iterator.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::find(x.begin(), 8, 'm');
static_assert(sprout::distance(x, result) == 2, "a found position is 2.");
Complexity
========================================
| linear.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -20,6 +20,12 @@ char_traits
to_int_type to_int_type
eq_int_type eq_int_type
eof eof
compare-iterator
length-iterator
find-iterator
move-iterator
copy-iterator
assign-iterator
Interface Interface
======================================== ========================================
@ -59,8 +65,8 @@ Interface
static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n); static SPROUT_CONSTEXPR int compare(char_type const* s1, ConstInputIterator s2, std::size_t n);
template<typename ConstInputIterator> template<typename ConstInputIterator>
static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n); static SPROUT_CONSTEXPR int compare(ConstInputIterator s1, char_type const* s2, std::size_t n);
template<typename ConstIterator1, typename ConstIterator2> template<typename ConstInputIterator1, typename ConstInputIterator2>
static SPROUT_CONSTEXPR int compare(ConstIterator1 s1, ConstIterator2 s2, std::size_t n); static SPROUT_CONSTEXPR int compare(ConstInputIterator1 s1, ConstInputIterator2 s2, std::size_t n);
template<typename ConstInputIterator> template<typename ConstInputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s); static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s);
template<typename ConstInputIterator> template<typename ConstInputIterator>
@ -137,7 +143,7 @@ string operations (for iterator)
function function
======================================== =============================================================================== ======================================== ===============================================================================
:doc:`compare <./compare-iterator>` :doc:`compare <./compare-iterator>`
:doc:`eqlength<./length-iterator>` :doc:`length<./length-iterator>`
:doc:`find <./find-iterator>` :doc:`find <./find-iterator>`
:doc:`move <./move-iterator>` :doc:`move <./move-iterator>`
:doc:`copy <./copy-iterator>` :doc:`copy <./copy-iterator>`

View file

@ -0,0 +1,40 @@
.. _sprout-string-char_traits-length-iterator:
###############################################################################
length
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename ConstInputIterator>
static SPROUT_CONSTEXPR std::size_t length(ConstInputIterator s);
Returns
========================================
| The smallest i such that ``eq(s[i], char_type())`` is true.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
using namespace sprout;
SPROUT_STATIC_CONSTEXPR auto x = string<8>("homuhomu");
SPROUT_STATIC_CONSTEXPR auto result = char_traits<char>::length(x.begin());
static_assert(result == 8, "length of x is 8.");
Complexity
========================================
| linear.
| Recursive function invocations in *O(logN)* (logarithmic) depth.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR bool lt(char_type c1, char_type c2) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR bool lt(char_type c1, char_type c2) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::lt(c1, c2)``. | Equivalent to ``std::char_traits<Char>::lt(c1, c2)``.

View file

@ -0,0 +1,42 @@
.. _sprout-string-char_traits-move-iterator:
###############################################################################
move
###############################################################################
Interface
========================================
.. sourcecode:: c++
template<typename OutputIterator, typename ConstInputIterator>
static OutputIterator move(OutputIterator s1, ConstInputIterator s2, std::size_t n);
Effects
========================================
| For each i in [0,n) performs ``assign(s1[i], p2[i])``.
| Copies correctly even where the ranges [s2,s2+n) and [s1,s1+n) overlap.
Examples
========================================
.. sourcecode:: c++
#include <sprout/string.hpp>
#include <sprout/assert.hpp>
using namespace sprout;
auto x = string<8>("homuhomu");;
SPROUT_STATIC_CONSTEXPR auto y = string<8>("madocchi");
char_traits<char>::move(x.begin(), y.begin(), 8);
SPROUT_ASSERT_MSG(x[0] == y[0], "y is copied to x.");
Complexity
========================================
| linear.
Header
========================================
| ``sprout/string/char_traits.hpp``
| Convenience header: ``sprout/string.hpp``

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR int_type not_eof(int_type c) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::not_eof(c)``. | Equivalent to ``std::char_traits<Char>::not_eof(c)``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR char_type to_char_type(int_type c) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::to_char_type(c)``. | Equivalent to ``std::char_traits<Char>::to_char_type(c)``.

View file

@ -9,7 +9,7 @@ Interface
static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT; static SPROUT_CONSTEXPR int_type to_int_type(char_type c) SPROUT_NOEXCEPT;
Effects Returns
======================================== ========================================
| Equivalent to ``std::char_traits<Char>::to_int_type(c)``. | Equivalent to ``std::char_traits<Char>::to_int_type(c)``.