Compare commits

..

1 Commits

Author SHA1 Message Date
nobody
e41b8607ae This commit was manufactured by cvs2svn to create tag
'Version_1_23_0'.

[SVN r10562]
2001-07-06 20:31:02 +00:00
7 changed files with 42 additions and 93 deletions

View File

@@ -85,7 +85,7 @@ Once that is done we can drop Multi-Pass Input Iterator.
<TABLE> <TABLE>
<TR valign=top> <TR valign=top>
<TD nowrap>Copyright &copy 2000</TD><TD> <TD nowrap>Copyright &copy 2000</TD><TD>
<A HREF=file:///c:/boost/site/people/jeremy_siek.htm>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>) <A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>, Univ.of Notre Dame (<A HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)
</TD></TR></TABLE> </TD></TR></TABLE>
</BODY> </BODY>

View File

@@ -9,9 +9,6 @@
// See http://www.boost.org for most recent version including documentation. // See http://www.boost.org for most recent version including documentation.
// Revision History // Revision History
// 25 Jun 01 output_iterator_helper changes: removed default template
// parameters, added support for self-proxying, additional
// documentation and tests (Aleksey Gurtovoy)
// 29 May 01 Added operator classes for << and >>. Added input and output // 29 May 01 Added operator classes for << and >>. Added input and output
// iterator helper classes. Added classes to connect equality and // iterator helper classes. Added classes to connect equality and
// relational operators. Added classes for groups of related // relational operators. Added classes for groups of related
@@ -704,17 +701,17 @@ struct input_iterator_helper
, dereferenceable<T, P , dereferenceable<T, P
, boost::iterator<std::input_iterator_tag, V, D, P, R , boost::iterator<std::input_iterator_tag, V, D, P, R
> > > > {}; > > > > {};
#ifndef BOOST_MSVC
template<class Derived> template <class T,
class V = void,
class D = void,
class P = void,
class R = void>
struct output_iterator_helper struct output_iterator_helper
: boost::incrementable<Derived : incrementable<T
, boost::iterator<std::output_iterator_tag, void, void, void, void , boost::iterator<std::output_iterator_tag, V, D, P, R
> > > > {};
{ #endif
Derived& operator*() { return static_cast<Derived&>(*this); }
Derived& operator++() { return static_cast<Derived&>(*this); }
};
template <class T, template <class T,
class V, class V,
class D = std::ptrdiff_t, class D = std::ptrdiff_t,

View File

@@ -93,7 +93,7 @@
<a href="function_output_iterator.htm">Function Output Iterator Adaptor</a> <a href="function_output_iterator.htm">Function Output Iterator Adaptor</a>
</ul> </ul>
<p><b><a href="file:///c:/boost/site/people/dave_abrahams.htm">Dave <p><b><a href="http://www.boost.org/people/dave_abrahams.htm">Dave
Abrahams</a></b> started the library, applying <a href= Abrahams</a></b> started the library, applying <a href=
"../../more/generic_programming.html#policy">policy class</a> technique and "../../more/generic_programming.html#policy">policy class</a> technique and
handling const/non-const iterator interactions. He also contributed the handling const/non-const iterator interactions. He also contributed the
@@ -102,7 +102,7 @@
<tt><a href="counting_iterator.htm">counting_iterator_generator</a></tt> to <tt><a href="counting_iterator.htm">counting_iterator_generator</a></tt> to
cover all incrementable types. He edited most of the documentation, cover all incrementable types. He edited most of the documentation,
sometimes heavily.<br> sometimes heavily.<br>
<b><a href="file:///c:/boost/site/people/jeremy_siek.htm">Jeremy <b><a href="http://www.boost.org/people/jeremy_siek.htm">Jeremy
Siek</a></b> contributed the <a href="transform_iterator.htm">transform Siek</a></b> contributed the <a href="transform_iterator.htm">transform
iterator</a> adaptor, the integer-only version of <tt><a href= iterator</a> adaptor, the integer-only version of <tt><a href=
"counting_iterator.htm">counting_iterator_generator</a></tt>, "counting_iterator.htm">counting_iterator_generator</a></tt>,
@@ -860,7 +860,7 @@ bool operator==(const iterator_adaptor&lt;B1,P,V1,R1,P1,C,D&gt;&amp;,
<hr> <hr>
<p>Revised <p>Revised
<!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->12 Jul 2001<!--webbot bot="Timestamp" endspan i-checksum="14985" --> <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->19 Mar 2001<!--webbot bot="Timestamp" endspan i-checksum="14895" -->
<p>&copy; Copyright Dave Abrahams and Jeremy Siek 2001. Permission to copy, <p>&copy; Copyright Dave Abrahams and Jeremy Siek 2001. Permission to copy,

View File

@@ -26,10 +26,6 @@
#include <string> // for std::string #include <string> // for std::string
#include <strstream> // for std::ostrstream #include <strstream> // for std::ostrstream
# ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::strcmp; }
# endif
// Iterator test class // Iterator test class
template <class T, class R, class P> template <class T, class R, class P>

View File

@@ -7,7 +7,6 @@
// See http://www.boost.org for most recent version including documentation. // See http://www.boost.org for most recent version including documentation.
// Revision History // Revision History
// 1 Apr 2001 Fixes for ICL; use BOOST_STATIC_CONSTANT
// 11 Feb 2001 Fixes for Borland (David Abrahams) // 11 Feb 2001 Fixes for Borland (David Abrahams)
// 23 Jan 2001 Added test for wchar_t (David Abrahams) // 23 Jan 2001 Added test for wchar_t (David Abrahams)
// 23 Jan 2001 Now statically selecting a test for signed numbers to avoid // 23 Jan 2001 Now statically selecting a test for signed numbers to avoid
@@ -31,6 +30,13 @@
# include <limits> # include <limits>
#endif #endif
// A macro for declaring class compile-time constants.
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# define DECLARE_CLASS_CONST(type, init) static const type init
#else
# define DECLARE_CLASS_CONST(type, init) enum { init }
#endif
// ================================================================================= // =================================================================================
// template class complement_traits<Number> -- // template class complement_traits<Number> --
// //
@@ -47,8 +53,8 @@ template <unsigned size> struct complement; // forward
template <class Number, unsigned size> template <class Number, unsigned size>
struct complement_traits_aux struct complement_traits_aux
{ {
BOOST_STATIC_CONSTANT(Number, max = complement<size>::template traits<Number>::max); DECLARE_CLASS_CONST(Number, max = complement<size>::template traits<Number>::max);
BOOST_STATIC_CONSTANT(Number, min = complement<size>::template traits<Number>::min); DECLARE_CLASS_CONST(Number, min = complement<size>::template traits<Number>::min);
}; };
template <unsigned size> template <unsigned size>
@@ -61,11 +67,11 @@ struct complement
// indirection through complement_traits_aux neccessary to keep MSVC happy // indirection through complement_traits_aux neccessary to keep MSVC happy
typedef complement_traits_aux<Number, size - 1> prev; typedef complement_traits_aux<Number, size - 1> prev;
public: public:
BOOST_STATIC_CONSTANT(Number, max = DECLARE_CLASS_CONST(Number, max =
Number(Number(prev::max) << CHAR_BIT) Number(Number(prev::max) << CHAR_BIT)
+ Number(UCHAR_MAX)); + Number(UCHAR_MAX));
BOOST_STATIC_CONSTANT(Number, min = Number(Number(prev::min) << CHAR_BIT)); DECLARE_CLASS_CONST(Number, min = Number(Number(prev::min) << CHAR_BIT));
}; };
}; };
@@ -79,8 +85,8 @@ template <> struct complement_base<false>
template <class Number> template <class Number>
struct values struct values
{ {
BOOST_STATIC_CONSTANT(Number, min = 0); DECLARE_CLASS_CONST(Number, min = 0);
BOOST_STATIC_CONSTANT(Number, max = UCHAR_MAX); DECLARE_CLASS_CONST(Number, max = UCHAR_MAX);
}; };
}; };
@@ -89,8 +95,8 @@ template <> struct complement_base<true>
template <class Number> template <class Number>
struct values struct values
{ {
BOOST_STATIC_CONSTANT(Number, min = SCHAR_MIN); DECLARE_CLASS_CONST(Number, min = SCHAR_MIN);
BOOST_STATIC_CONSTANT(Number, max = SCHAR_MAX); DECLARE_CLASS_CONST(Number, max = SCHAR_MAX);
}; };
}; };
@@ -101,10 +107,10 @@ struct complement<1>
template <class Number> template <class Number>
struct traits struct traits
{ {
BOOST_STATIC_CONSTANT(bool, is_signed = boost::detail::is_signed<Number>::value); DECLARE_CLASS_CONST(bool, is_signed = boost::detail::is_signed<Number>::value);
BOOST_STATIC_CONSTANT(Number, min = DECLARE_CLASS_CONST(Number, min =
complement_base<is_signed>::template values<Number>::min); complement_base<is_signed>::template values<Number>::min);
BOOST_STATIC_CONSTANT(Number, max = DECLARE_CLASS_CONST(Number, max =
complement_base<is_signed>::template values<Number>::max); complement_base<is_signed>::template values<Number>::max);
}; };
}; };
@@ -115,8 +121,8 @@ struct complement<1>
template <class Number> template <class Number>
struct complement_traits struct complement_traits
{ {
BOOST_STATIC_CONSTANT(Number, max = (complement_traits_aux<Number, sizeof(Number)>::max)); DECLARE_CLASS_CONST(Number, max = (complement_traits_aux<Number, sizeof(Number)>::max));
BOOST_STATIC_CONSTANT(Number, min = (complement_traits_aux<Number, sizeof(Number)>::min)); DECLARE_CLASS_CONST(Number, min = (complement_traits_aux<Number, sizeof(Number)>::min));
}; };
// ================================================================================= // =================================================================================
@@ -145,9 +151,9 @@ template <> struct stream_as<signed char> {
typedef unsigned char t1; typedef unsigned t2; typedef unsigned char t1; typedef unsigned t2;
}; };
#if defined(BOOST_MSVC_STD_ITERATOR) // No intmax streaming built-in #if defined(BOOST_MSVC) // No intmax streaming built-in
// With this library implementation, __int64 and __uint64 get streamed as strings // On this platform, __int64 and __uint64 get streamed as strings
template <> struct stream_as<boost::uintmax_t> { template <> struct stream_as<boost::uintmax_t> {
typedef std::string t1; typedef std::string t1;
typedef std::string t2; typedef std::string t2;
@@ -168,7 +174,7 @@ template <class T> struct promote
} }
}; };
#if defined(BOOST_MSVC_STD_ITERATOR) // No intmax streaming built-in #if defined(BOOST_MSVC) // No intmax streaming built-in
// On this platform, stream them as long/unsigned long if they fit. // On this platform, stream them as long/unsigned long if they fit.
// Otherwise, write a string. // Otherwise, write a string.

View File

@@ -50,7 +50,6 @@ provided by the class.</p>
<ul> <ul>
<li><a href="#dereference">Dereference operators</a></li> <li><a href="#dereference">Dereference operators</a></li>
<li><a href="#iterator">Iterator Helpers</a></li> <li><a href="#iterator">Iterator Helpers</a></li>
<li><a href="#iterator_helpers_notes">Iterator Helper Notes</a></li>
<li><a href="#i_demo">Iterator Demonstration and Test <li><a href="#i_demo">Iterator Demonstration and Test
Program</a></li> Program</a></li>
</ul></li> </ul></li>
@@ -890,7 +889,7 @@ href="#chaining">base class chaining</a>.</p>
<h3><a name="iterator">Iterator</a> Helpers</h3> <h3><a name="iterator">Iterator</a> Helpers</h3>
<p>There are five separate iterator helper classes, each for a <p>There are three separate iterator helper classes, each for a
different category of iterator. Here is a summary of the core set of different category of iterator. Here is a summary of the core set of
operators that the custom iterator must define, and the extra operators operators that the custom iterator must define, and the extra operators
that are created by the helper classes. These classes cannot be used for <a that are created by the helper classes. These classes cannot be used for <a
@@ -932,13 +931,11 @@ C++ standard (<code>iterator_category</code>, <code>value_type</code>,
</ul></td> </ul></td>
</tr> </tr>
<tr valign="baseline"> <tr valign="baseline">
<td><code><a name="output_iterator_helper">output_iterator_helper&lt;T&gt;</a></code></td> <td><code><a name="output_iterator_helper">output_iterator_helper&lt;T, V, D, P, R&gt;</a></code></td>
<td>Supports the operations and has the requirements of <td>Supports the operations and has the requirements of
<ul> <ul>
<li><code><a href="#incrementable">incrementable&lt;T&gt;</a></code></li> <li><code><a href="#incrementable">incrementable&lt;T&gt;</a></code></li>
</ul> </ul></td>
See also [<a href="#1">1</a>], [<a href="#2">2</a>].
</td>
</tr> </tr>
<tr valign="baseline"> <tr valign="baseline">
<td><code><a name="forward_iterator_helper">forward_iterator_helper&lt;T, V, D, P, R&gt;</a></code></td> <td><code><a name="forward_iterator_helper">forward_iterator_helper&lt;T, V, D, P, R&gt;</a></code></td>
@@ -978,53 +975,6 @@ C++ standard (<code>iterator_category</code>, <code>value_type</code>,
</tr> </tr>
</table> </table>
<h3><a name="iterator_helpers_notes">Iterator Helper Notes</a></h3>
<p><a name="1">[1]</a> Unlike other iterator helpers templates,
<code>output_iterator_helper</code> takes only one template parameter - the type of
its target class. Although to some it might seem like an unnecessary
restriction, the standard requires <code>difference_type</code> and
<code>value_type</code> of any output iterator to be
<code>void</code> (24.3.1 [lib.iterator.traits]), and
<code>output_iterator_helper</code> template respects this
requirement. Also, output iterators in the standard have void <tt>pointer</tt> and
<tt>reference</tt> types, so the <tt>output_iterator_helper</tt> does the
same.
<p><a name="2">[2]</a> As self-proxying is the easiest and most common way to
implement output iterators (see, for example, insert [24.4.2] and stream
iterators [24.5] in the standard library), <code>output_iterator_helper</code>
supports the idiom by defining <code>operator*</code>
and <code>operator++</code> member functions which just return a
non-const reference to the iterator itself. Support for
self-proxying allows us, in many cases, to reduce the task of writing an output
iterator to writing just two member functions - an appropriate
constructor and a copy-assignment operator. For example, here is a possible
implementation of <code><a href="function_output_iterator.htm">boost::function_output_iterator</a></code>
adaptor:</p>
<pre>
template&lt;class UnaryFunction&gt;
struct function_output_iterator
: boost::output_iterator_helper&lt; function_output_iterator&lt;UnaryFunction&gt; &gt;
{
explicit function_output_iterator(UnaryFunction const& f = UnaryFunction())
: func(f) {}
template&lt;typename T&gt;
function_output_iterator& operator=(T const& value)
{
this->func(value);
return *this;
}
private:
UnaryFunction func;
};
</pre>
<p>Note that support for self-proxying does not prevent you from using <code>output_iterator_helper</code> to ease any other, different kind of output iterator's implementation. If <code>output_iterator_helper</code>'s target type provides its own definition of <code>operator*</code> or/and <code>operator++</code>, then these operators will get used and the ones supplied by <code>output_iterator_helper</code> will never be instantiated.</p>
<h3><a name="i_demo">Iterator Demonstration</a> and Test Program</h3> <h3><a name="i_demo">Iterator Demonstration</a> and Test Program</h3>
<p>The <cite><a href="iterators_test.cpp">iterators_test.cpp</a></cite> <p>The <cite><a href="iterators_test.cpp">iterators_test.cpp</a></cite>
@@ -1142,7 +1092,7 @@ the library remain backward-compatible.</p>
<hr> <hr>
<p>Revised: 25 Jun 2001</p> <p>Revised: 20 May 2001</p>
<p>Copyright &copy; David Abrahams and Beman Dawes 1999-2001. <p>Copyright &copy; David Abrahams and Beman Dawes 1999-2001.
Permission to copy, use, modify, sell and distribute this document is Permission to copy, use, modify, sell and distribute this document is

View File

@@ -126,7 +126,7 @@ The output is:
<TABLE> <TABLE>
<TR valign=top> <TR valign=top>
<TD nowrap>Copyright &copy 2000</TD><TD> <TD nowrap>Copyright &copy 2000</TD><TD>
<A HREF=file:///c:/boost/site/people/jeremy_siek.htm>Jeremy Siek</A>, <A HREF=http://www.boost.org/people/jeremy_siek.htm>Jeremy Siek</A>,
Univ.of Notre Dame (<A Univ.of Notre Dame (<A
HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)<br> HREF="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</A>)<br>
<A HREF=http://www.lsc.nd.edu/~llee1>Lie-Quan Lee</A>, Univ.of Notre Dame (<A HREF="mailto:llee1@lsc.nd.edu">llee1@lsc.nd.edu</A>)<br> <A HREF=http://www.lsc.nd.edu/~llee1>Lie-Quan Lee</A>, Univ.of Notre Dame (<A HREF="mailto:llee1@lsc.nd.edu">llee1@lsc.nd.edu</A>)<br>