diff --git a/Assignable.html b/Assignable.html
deleted file mode 100644
index c3109df..0000000
--- a/Assignable.html
+++ /dev/null
@@ -1,116 +0,0 @@
-
-
-
-Assignable
-
-
-
-
-
-Assignable
-
-Description
-A type is Assignable if it is possible to assign one object of the type
-to another object of that type.
-
-
-Notation
-
-
-
-T
- |
-
-is type that is a model of Assignable
- |
-
-
-
-
-t
- |
-
-is an object of type T
- |
-
-
-
-
-u
- |
-
-is an object of type T or possibly const T
- |
-
-
-
-Definitions
-Valid expressions
-
-
-
-Name
- |
-
-Expression
- |
-
-Return type
- |
-
-Semantics
- |
-
-
-
-Assignment
- |
-
-t = u
- |
-
-T&
- |
-
-t is equivalent to u
- |
-
-
-
-
-
-
-Models
-
-
-
-See also
-DefaultConstructible
-and
-CopyConstructible
-
-
-
-
-
-
-
diff --git a/CopyConstructible.html b/CopyConstructible.html
deleted file mode 100644
index 4134f5e..0000000
--- a/CopyConstructible.html
+++ /dev/null
@@ -1,210 +0,0 @@
-
-
-
-CopyConstructible
-
-
-
-
-
-CopyConstructible
-
-Description
-A type is CopyConstructible if it is possible to copy objects of that
-type.
-
-Notation
-
-
-
-T
- |
-
-is type that is a model of CopyConstructible
- |
-
-
-
-
-t
- |
-
-is an object of type T
- |
-
-
-
-
-u
- |
-
-is an object of type const T
- |
-
-
-
-Definitions
-Valid expressions
-
-
-
-Name
- |
-
-Expression
- |
-
-Return type
- |
-
-Semantics
- |
-
-
-
-Copy constructor
- |
-
-T(t)
- |
-
-T
- |
-
-t is equivalent to T(t)
- |
-
-
-
-
-
-Copy constructor
- |
-
-
-T(u)
-
- |
-
-T
- |
-
-u is equivalent to T(u)
- |
-
-
-
-
-
-Destructor
- |
-
-
-t.~T()
-
- |
-
-T
- |
-
-
- |
-
-
-
-
-Address Operator
- |
-
-
-&t
-
- |
-
-T*
- |
-
-denotes the address of t
- |
-
-
-
-
-Address Operator
- |
-
-
-&u
-
- |
-
-T*
- |
-
-denotes the address of u
- |
-
-
-
-
-
-
-
-
-Models
-
-
-
-Concept Checking Class
-
-
- template <class T>
- struct CopyConstructibleConcept
- {
- void constraints() {
- T a(b); // require copy constructor
- T* ptr = &a; // require address of operator
- const_constraints(a);
- ignore_unused_variable_warning(ptr);
- }
- void const_constraints(const T& a) {
- T c(a); // require const copy constructor
- const T* ptr = &a; // require const address of operator
- ignore_unused_variable_warning(c);
- ignore_unused_variable_warning(ptr);
- }
- T b;
- };
-
-
-See also
-DefaultConstructible
-and
-Assignable
-
-
-
-
-
-
-
diff --git a/LessThanComparable.html b/LessThanComparable.html
deleted file mode 100644
index 294101c..0000000
--- a/LessThanComparable.html
+++ /dev/null
@@ -1,212 +0,0 @@
-
-
-
-
-LessThanComparable
-
-
-
-
-
-LessThanComparable
-
-Description
-A type is LessThanComparable if it is ordered: it must
-be possible to compare two objects of that type using operator<, and
-operator< must be a strict weak ordering relation.
-
-
-Refinement of
-Associated types
-Notation
-
-
-
-X
- |
-
-A type that is a model of LessThanComparable
- |
-
-
-
-x, y, z
- |
-
-Object of type X
- |
-
-
-Definitions
-Consider the relation !(x < y) && !(y < x). If this relation is
-transitive (that is, if !(x < y) && !(y < x) && !(y < z) && !(z < y)
-implies !(x < z) && !(z < x)), then it satisfies the mathematical
-definition of an equivalence relation. In this case, operator<
-is a strict weak ordering.
-
-If operator< is a strict weak ordering, and if each equivalence class
-has only a single element, then operator< is a total ordering.
-
Valid expressions
-
-
-
-Name
- |
-
-Expression
- |
-
-Type requirements
- |
-
-Return type
- |
-
-
-
-Less
- |
-
-x < y
- |
-
-
- |
-
-Convertible to bool
- |
-
-
-
-
-
-Expression semantics
-
-
-
-Name
- |
-
-Expression
- |
-
-Precondition
- |
-
-Semantics
- |
-
-Postcondition
- |
-
-
-
-Less
- |
-
-x < y
- |
-
-x and y are in the domain of <
- |
-
-
- |
-
-
-
-Complexity guarantees
-Invariants
-
-
-
-Irreflexivity
- |
-
-x < x must be false.
- |
-
-
-
-Antisymmetry
- |
-
-x < y implies !(y < x) [2]
- |
-
-
-
-Transitivity
- |
-
-x < y and y < z implies x < z [3]
- |
-
-
-Models
-
-Notes
-[1]
-Only operator< is fundamental; the other inequality operators
-are essentially syntactic sugar.
-
[2]
-Antisymmetry is a theorem, not an axiom: it follows from
-irreflexivity and transitivity.
-
[3]
-Because of irreflexivity and transitivity, operator< always
-satisfies the definition of a partial ordering. The definition of
-a strict weak ordering is stricter, and the definition of a
-total ordering is stricter still.
-
See also
-EqualityComparable, StrictWeakOrdering
-
-
-
-
-
-
-
-
-
diff --git a/MultiPassInputIterator.html b/MultiPassInputIterator.html
deleted file mode 100644
index 99ee2fc..0000000
--- a/MultiPassInputIterator.html
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-MultiPassInputIterator
-
-
-
-
-
-
-
-MultiPassInputIterator
-
-
-This concept is a refinement of InputIterator,
-adding the requirements that the iterator can be used to make multiple
-passes through a range, and that if it1 == it2 and
-it1 is dereferenceable then ++it1 == ++it2. The
-MultiPassInputIterator is very similar to the ForwardIterator. The
-only difference is that a ForwardIterator
-requires the reference type to be value_type&, whereas
-MultiPassInputIterator is like InputIterator
-in that the reference type merely has to be convertible to
-value_type.
-
-
-Design Notes
-
-comments by Valentin Bonnard:
-
- I think that introducing MultiPassInputIterator isn't the right
-solution. Do you also want to define MultiPassBidirectionnalIterator
-and MultiPassRandomAccessIterator ? I don't, definitly. It only
-confuses the issue. The problem lies into the existing hierarchy of
-iterators, which mixes movabillity, modifiabillity and lvalue-ness,
-and these are clearly independant.
-
-
The terms Forward, Bidirectionnal and RandomAccess are about
-movabillity and shouldn't be used to mean anything else. In a
-completly orthogonal way, iterators can be immutable, mutable, or
-neither. Lvalueness of iterators is also orthogonal with
-immutabillity. With these clean concepts, your MultiPassInputIterator
-is just called a ForwardIterator.
-
-
-Other translations are:
-std::ForwardIterator -> ForwardIterator & LvalueIterator
-std::BidirectionnalIterator -> BidirectionnalIterator & LvalueIterator
-std::RandomAccessIterator -> RandomAccessIterator & LvalueIterator
-
-
-Note that in practice the only operation not allowed on my
-ForwardIterator which is allowed on std::ForwardIterator is
-&*it. I think that &* is rarely needed in generic code.
-
-
-reply by Jeremy Siek:
-
-
-The above analysis by Valentin is right on. Of course, there is
-the problem with backward compatibility. The current STL implementations
-are based on the old definition of ForwardIterator. The right course
-of action is to get ForwardIterator, etc. changed in the C++ standard.
-Once that is done we can drop MultiPassInputIterator.
-
-
-
-
-
-
-
-
diff --git a/call_traits.htm b/call_traits.htm
deleted file mode 100644
index 78cb60f..0000000
--- a/call_traits.htm
+++ /dev/null
@@ -1,754 +0,0 @@
-
-
-
-
-
-
-Call Traits
-
-
-
-
-
-
-All of the contents of <boost/call_traits.hpp> are
-defined inside namespace boost.
-
-The template class call_traits<T> encapsulates the
-"best" method to pass a parameter of some type T to or
-from a function, and consists of a collection of typedefs defined
-as in the table below. The purpose of call_traits is to ensure
-that problems like "references to references"
-never occur, and that parameters are passed in the most efficient
-manner possible (see examples). In each
-case if your existing practice is to use the type defined on the
-left, then replace it with the call_traits defined type on the
-right.
-
-Note that for compilers that do not support either partial
-specialization or member templates, no benefit will occur from
-using call_traits: the call_traits defined types will always be
-the same as the existing practice in this case. In addition if
-only member templates and not partial template specialisation is
-support by the compiler (for example Visual C++ 6) then call_traits
-can not be used with array types (although it can be used to
-solve the reference to reference problem).
-
-
-
- Existing practice
- |
- call_traits equivalent
- |
- Description
- |
- Notes
- |
-
-
- T
- (return by value)
- |
- call_traits<T>::value_type
- |
- Defines a type that
- represents the "value" of type T. Use this for
- functions that return by value, or possibly for stored
- values of type T. |
- 2
- |
-
-
- T&
- (return value)
- |
- call_traits<T>::reference
- |
- Defines a type that
- represents a reference to type T. Use for functions that
- would normally return a T&. |
- 1
- |
-
-
- const T&
- (return value)
- |
- call_traits<T>::const_reference
- |
- Defines a type that
- represents a constant reference to type T. Use for
- functions that would normally return a const T&. |
- 1
- |
-
-
- const T&
- (function parameter)
- |
- call_traits<T>::param_type
- |
- Defines a type that
- represents the "best" way to pass a parameter
- of type T to a function. |
- 1,3
- |
-
-
-
-Notes:
-
-
- - If T is already reference type, then call_traits is
- defined such that references to
- references do not occur (requires partial
- specialization).
- - If T is an array type, then call_traits defines
value_type
- as a "constant pointer to type" rather than an
- "array of type" (requires partial
- specialization). Note that if you are using value_type as
- a stored value then this will result in storing a "constant
- pointer to an array" rather than the array itself.
- This may or may not be a good thing depending upon what
- you actually need (in other words take care!).
- - If T is a small built in type or a pointer, then
param_type
- is defined as T const
, instead of T
- const&
. This can improve the ability of the
- compiler to optimize loops in the body of the function if
- they depend upon the passed parameter, the semantics of
- the passed parameter is otherwise unchanged (requires
- partial specialization).
-
-
-
-
-Copy constructibility
-
-The following table defines which call_traits types can always
-be copy-constructed from which other types, those entries marked
-with a '?' are true only if and only if T is copy constructible:
-
-
-
- |
- To:
- |
-
-
- From: |
- T
- |
- value_type
- |
- reference
- |
- const_reference
- |
- param_type
- |
-
-
- T |
- ?
- |
- ?
- |
- Y
- |
- Y
- |
- Y
- |
-
-
- value_type |
- ?
- |
- ?
- |
- N
- |
- N
- |
- Y
- |
-
-
- reference |
- ?
- |
- ?
- |
- Y
- |
- Y
- |
- Y
- |
-
-
- const_reference |
- ?
- |
- N
- |
- N
- |
- Y
- |
- Y
- |
-
-
- param_type |
- ?
- |
- ?
- |
- N
- |
- N
- |
- Y
- |
-
-
-
-
-
-If T is an assignable type the following assignments are
-possible:
-
-
-
- |
- To:
- |
-
-
- From: |
- T
- |
- value_type
- |
- reference
- |
- const_reference
- |
- param_type
- |
-
-
- T |
- Y
- |
- Y
- |
- -
- |
- -
- |
- -
- |
-
-
- value_type |
- Y
- |
- Y
- |
- -
- |
- -
- |
- -
- |
-
-
- reference |
- Y
- |
- Y
- |
- -
- |
- -
- |
- -
- |
-
-
- const_reference |
- Y
- |
- Y
- |
- -
- |
- -
- |
- -
- |
-
-
- param_type |
- Y
- |
- Y
- |
- -
- |
- -
- |
- -
- |
-
-
-
-
-
-Examples
-
-The following table shows the effect that call_traits has on
-various types, the table assumes that the compiler supports
-partial specialization: if it doesn't then all types behave in
-the same way as the entry for "myclass", and call_traits
-can not be used with reference or array types.
-
-
-
- |
- Call_traits type:
- |
-
-
- Original type T
- |
- value_type
- |
- reference
- |
- const_reference
- |
- param_type
- |
- Applies to:
- |
-
-
- myclass
- |
- myclass
- |
- myclass&
- |
- const
- myclass&
- |
- myclass
- const&
- |
- All user
- defined types.
- |
-
-
- int
- |
- int
- |
- int&
- |
- const int&
- |
- int const
- |
- All small
- built-in types.
- |
-
-
- int*
- |
- int*
- |
- int*&
- |
- int*const&
- |
- int* const
- |
- All
- pointer types.
- |
-
-
- int&
- |
- int&
- |
- int&
- |
- const int&
- |
- int&
- |
- All
- reference types.
- |
-
-
- const int&
- |
- const int&
- |
- const int&
- |
- const int&
- |
- const int&
- |
- All
- constant-references.
- |
-
-
- int[3]
- |
- const int*
- |
- int(&)[3]
- |
- const int(&)[3]
- |
- const int*
- const
- |
- All array
- types.
- |
-
-
- const int[3]
- |
- const int*
- |
- const int(&)[3]
- |
- const int(&)[3]
- |
- const int*
- const
- |
- All
- constant-array types.
- |
-
-
-
-
-
-Example 1:
-
-The following class is a trivial class that stores some type T
-by value (see the call_traits_test.cpp
-file), the aim is to illustrate how each of the available call_traits
-typedefs may be used:
-
-template <class T>
-struct contained
-{
- // define our typedefs first, arrays are stored by value
- // so value_type is not the same as result_type:
- typedef typename boost::call_traits<T>::param_type param_type;
- typedef typename boost::call_traits<T>::reference reference;
- typedef typename boost::call_traits<T>::const_reference const_reference;
- typedef T value_type;
- typedef typename boost::call_traits<T>::value_type result_type;
-
- // stored value:
- value_type v_;
-
- // constructors:
- contained() {}
- contained(param_type p) : v_(p){}
- // return byval:
- result_type value() { return v_; }
- // return by_ref:
- reference get() { return v_; }
- const_reference const_get()const { return v_; }
- // pass value:
- void call(param_type p){}
-
-};
-
-Example 2 (the reference to reference
-problem):
-
-Consider the definition of std::binder1st:
-
-template <class Operation>
-class binder1st :
- public unary_function<Operation::second_argument_type, Operation::result_type>
-{
-protected:
- Operation op;
- Operation::first_argument_type value;
-public:
- binder1st(const Operation& x, const Operation::first_argument_type& y);
- Operation::result_type operator()(const Operation::second_argument_type& x) const;
-};
-
-Now consider what happens in the relatively common case that
-the functor takes its second argument as a reference, that
-implies that Operation::second_argument_type
is a
-reference type, operator()
will now end up taking a
-reference to a reference as an argument, and that is not
-currently legal. The solution here is to modify operator()
-to use call_traits:
-
-Operation::result_type operator()(call_traits<Operation::second_argument_type>::param_type x) const;
-
-Now in the case that Operation::second_argument_type
-is a reference type, the argument is passed as a reference, and
-the no "reference to reference" occurs.
-
-Example 3 (the make_pair problem):
-
-If we pass the name of an array as one (or both) arguments to std::make_pair
,
-then template argument deduction deduces the passed parameter as
-"const reference to array of T", this also applies to
-string literals (which are really array literals). Consequently
-instead of returning a pair of pointers, it tries to return a
-pair of arrays, and since an array type is not copy-constructible
-the code fails to compile. One solution is to explicitly cast the
-arguments to make_pair to pointers, but call_traits provides a
-better (i.e. automatic) solution (and one that works safely even
-in generic code where the cast might do the wrong thing):
-
-template <class T1, class T2>
-std::pair<
- typename boost::call_traits<T1>::value_type,
- typename boost::call_traits<T2>::value_type>
- make_pair(const T1& t1, const T2& t2)
-{
- return std::pair<
- typename boost::call_traits<T1>::value_type,
- typename boost::call_traits<T2>::value_type>(t1, t2);
-}
-
-Here, the deduced argument types will be automatically
-degraded to pointers if the deduced types are arrays, similar
-situations occur in the standard binders and adapters: in
-principle in any function that "wraps" a temporary
-whose type is deduced. Note that the function arguments to make_pair
-are not expressed in terms of call_traits: doing so would prevent
-template argument deduction from functioning.
-
-Example 4 (optimising fill):
-
-The call_traits template will "optimize" the passing
-of a small built-in type as a function parameter, this mainly has
-an effect when the parameter is used within a loop body. In the
-following example (see algo_opt_examples.cpp),
-a version of std::fill is optimized in two ways: if the type
-passed is a single byte built-in type then std::memset is used to
-effect the fill, otherwise a conventional C++ implemention is
-used, but with the passed parameter "optimized" using
-call_traits:
-
-namespace detail{
-
-template <bool opt>
-struct filler
-{
- template <typename I, typename T>
- static void do_fill(I first, I last, typename boost::call_traits<T>::param_type val);
- {
- while(first != last)
- {
- *first = val;
- ++first;
- }
- }
-};
-
-template <>
-struct filler<true>
-{
- template <typename I, typename T>
- static void do_fill(I first, I last, T val)
- {
- memset(first, val, last-first);
- }
-};
-
-}
-
-template <class I, class T>
-inline void fill(I first, I last, const T& val)
-{
- enum{ can_opt = boost::is_pointer<I>::value
- && boost::is_arithmetic<T>::value
- && (sizeof(T) == 1) };
- typedef detail::filler<can_opt> filler_t;
- filler_t::template do_fill<I,T>(first, last, val);
-}
-
-Footnote: the reason that this is "optimal" for
-small built-in types is that with the value passed as "T
-const" instead of "const T&" the compiler is
-able to tell both that the value is constant and that it is free
-of aliases. With this information the compiler is able to cache
-the passed value in a register, unroll the loop, or use
-explicitly parallel instructions: if any of these are supported.
-Exactly how much mileage you will get from this depends upon your
-compiler - we could really use some accurate benchmarking
-software as part of boost for cases like this.
-
-Note that the function arguments to fill are not expressed in
-terms of call_traits: doing so would prevent template argument
-deduction from functioning. Instead fill acts as a "thin
-wrapper" that is there to perform template argument
-deduction, the compiler will optimise away the call to fill all
-together, replacing it with the call to filler<>::do_fill,
-which does use call_traits.
-
-Rationale
-
-The following notes are intended to briefly describe the
-rational behind choices made in call_traits.
-
-All user-defined types follow "existing practice"
-and need no comment.
-
-Small built-in types (what the standard calls fundamental
-types [3.9.1]) differ from existing practice only in the param_type
-typedef. In this case passing "T const" is compatible
-with existing practice, but may improve performance in some cases
-(see Example 4), in any case this should never
-be any worse than existing practice.
-
-Pointers follow the same rational as small built-in types.
-
-For reference types the rational follows Example
-2 - references to references are not allowed, so the call_traits
-members must be defined such that these problems do not occur.
-There is a proposal to modify the language such that "a
-reference to a reference is a reference" (issue #106,
-submitted by Bjarne Stroustrup), call_traits<T>::value_type
-and call_traits<T>::param_type both provide the same effect
-as that proposal, without the need for a language change (in
-other words it's a workaround).
-
-For array types, a function that takes an array as an argument
-will degrade the array type to a pointer type: this means that
-the type of the actual parameter is different from its declared
-type, something that can cause endless problems in template code
-that relies on the declared type of a parameter. For example:
-
-template <class T>
-struct A
-{
- void foo(T t);
-};
-
-In this case if we instantiate A<int[2]>
-then the declared type of the parameter passed to member function
-foo is int[2], but it's actual type is const int*, if we try to
-use the type T within the function body, then there is a strong
-likelyhood that our code will not compile:
-
-template <class T>
-void A<T>::foo(T t)
-{
- T dup(t); // doesn't compile for case that T is an array.
-}
-
-By using call_traits the degradation from array to pointer is
-explicit, and the type of the parameter is the same as it's
-declared type:
-
-template <class T>
-struct A
-{
- void foo(call_traits<T>::value_type t);
-};
-
-template <class T>
-void A<T>::foo(call_traits<T>::value_type t)
-{
- call_traits<T>::value_type dup(t); // OK even if T is an array type.
-}
-
-For value_type (return by value), again only a pointer may be
-returned, not a copy of the whole array, and again call_traits
-makes the degradation explicit. The value_type member is useful
-whenever an array must be explicitly degraded to a pointer - Example 3 provides the test case (Footnote: the
-array specialisation for call_traits is the least well understood
-of all the call_traits specialisations, if the given semantics
-cause specific problems for you, or don't solve a particular
-array-related problem, then I would be interested to hear about
-it. Most people though will probably never need to use this
-specialisation).
-
-
-
-Revised 01 September 2000
-
-© Copyright boost.org 2000. Permission to copy, use, modify,
-sell and distribute this document is granted provided this
-copyright notice appears in all copies. This document is provided
-"as is" without express or implied warranty, and with
-no claim as to its suitability for any purpose.
-
-Based on contributions by Steve Cleary, Beman Dawes, Howard
-Hinnant and John Maddock.
-
-Maintained by John
-Maddock, the latest version of this file can be found at www.boost.org, and the boost
-discussion list at www.egroups.com/list/boost.
-
-.
-
-
-
-
-
-
diff --git a/call_traits_test.cpp b/call_traits_test.cpp
deleted file mode 100644
index 762d8b8..0000000
--- a/call_traits_test.cpp
+++ /dev/null
@@ -1,375 +0,0 @@
- // boost::compressed_pair test program
-
- // (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
- // distribute this software is granted provided this copyright notice appears
- // in all copies. This software is provided "as is" without express or implied
- // warranty, and with no claim as to its suitability for any purpose.
-
-// standalone test program for
-// 03 Oct 2000:
-// Enabled extra tests for VC6.
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-//
-// struct contained models a type that contains a type (for example std::pair)
-// arrays are contained by value, and have to be treated as a special case:
-//
-template
-struct contained
-{
- // define our typedefs first, arrays are stored by value
- // so value_type is not the same as result_type:
- typedef typename boost::call_traits::param_type param_type;
- typedef typename boost::call_traits::reference reference;
- typedef typename boost::call_traits::const_reference const_reference;
- typedef T value_type;
- typedef typename boost::call_traits::value_type result_type;
-
- // stored value:
- value_type v_;
-
- // constructors:
- contained() {}
- contained(param_type p) : v_(p){}
- // return byval:
- result_type value()const { return v_; }
- // return by_ref:
- reference get() { return v_; }
- const_reference const_get()const { return v_; }
- // pass value:
- void call(param_type p){}
-
-};
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-template
-struct contained
-{
- typedef typename boost::call_traits::param_type param_type;
- typedef typename boost::call_traits::reference reference;
- typedef typename boost::call_traits::const_reference const_reference;
- typedef T value_type[N];
- typedef typename boost::call_traits::value_type result_type;
-
- value_type v_;
-
- contained(param_type p)
- {
- std::copy(p, p+N, v_);
- }
- // return byval:
- result_type value()const { return v_; }
- // return by_ref:
- reference get() { return v_; }
- const_reference const_get()const { return v_; }
- void call(param_type p){}
-};
-#endif
-
-template
-contained::value_type> wrap(const T& t)
-{
- typedef typename boost::call_traits::value_type ct;
- return contained(t);
-}
-
-namespace test{
-
-template
-std::pair<
- typename boost::call_traits::value_type,
- typename boost::call_traits::value_type>
- make_pair(const T1& t1, const T2& t2)
-{
- return std::pair<
- typename boost::call_traits::value_type,
- typename boost::call_traits::value_type>(t1, t2);
-}
-
-} // namespace test
-
-using namespace std;
-
-//
-// struct call_traits_checker:
-// verifies behaviour of contained example:
-//
-template
-struct call_traits_checker
-{
- typedef typename boost::call_traits::param_type param_type;
- void operator()(param_type);
-};
-
-template
-void call_traits_checker::operator()(param_type p)
-{
- T t(p);
- contained c(t);
- cout << "checking contained<" << typeid(T).name() << ">..." << endl;
- assert(t == c.value());
- assert(t == c.get());
- assert(t == c.const_get());
-
- //cout << "typeof contained<" << typeid(T).name() << ">::v_ is: " << typeid(&contained::v_).name() << endl;
- cout << "typeof contained<" << typeid(T).name() << ">::value() is: " << typeid(&contained::value).name() << endl;
- cout << "typeof contained<" << typeid(T).name() << ">::get() is: " << typeid(&contained::get).name() << endl;
- cout << "typeof contained<" << typeid(T).name() << ">::const_get() is: " << typeid(&contained::const_get).name() << endl;
- cout << "typeof contained<" << typeid(T).name() << ">::call() is: " << typeid(&contained::call).name() << endl;
- cout << endl;
-}
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-template
-struct call_traits_checker
-{
- typedef typename boost::call_traits::param_type param_type;
- void operator()(param_type t)
- {
- contained c(t);
- cout << "checking contained<" << typeid(T[N]).name() << ">..." << endl;
- unsigned int i = 0;
- for(i = 0; i < N; ++i)
- assert(t[i] == c.value()[i]);
- for(i = 0; i < N; ++i)
- assert(t[i] == c.get()[i]);
- for(i = 0; i < N; ++i)
- assert(t[i] == c.const_get()[i]);
-
- cout << "typeof contained<" << typeid(T[N]).name() << ">::v_ is: " << typeid(&contained::v_).name() << endl;
- cout << "typeof contained<" << typeid(T[N]).name() << ">::value is: " << typeid(&contained::value).name() << endl;
- cout << "typeof contained<" << typeid(T[N]).name() << ">::get is: " << typeid(&contained::get).name() << endl;
- cout << "typeof contained<" << typeid(T[N]).name() << ">::const_get is: " << typeid(&contained::const_get).name() << endl;
- cout << "typeof contained<" << typeid(T[N]).name() << ">::call is: " << typeid(&contained::call).name() << endl;
- cout << endl;
- }
-};
-#endif
-
-//
-// check_wrap:
-template
-void check_wrap(const contained& w, const U& u)
-{
- cout << "checking contained<" << typeid(T).name() << ">..." << endl;
- assert(w.value() == u);
-}
-
-//
-// check_make_pair:
-// verifies behaviour of "make_pair":
-//
-template
-void check_make_pair(T c, U u, V v)
-{
- cout << "checking std::pair<" << typeid(c.first).name() << ", " << typeid(c.second).name() << ">..." << endl;
- assert(c.first == u);
- assert(c.second == v);
- cout << endl;
-}
-
-
-struct comparible_UDT
-{
- int i_;
- comparible_UDT() : i_(2){}
- bool operator == (const comparible_UDT& v){ return v.i_ == i_; }
-};
-
-int main(int argc, char *argv[ ])
-{
- call_traits_checker c1;
- comparible_UDT u;
- c1(u);
- call_traits_checker c2;
- int i = 2;
- c2(i);
- int* pi = &i;
-#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
- call_traits_checker c3;
- c3(pi);
- call_traits_checker c4;
- c4(i);
- call_traits_checker c5;
- c5(i);
-#if !defined (BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- int a[2] = {1,2};
- call_traits_checker c6;
- c6(a);
-#endif
-#endif
-
- check_wrap(wrap(2), 2);
- const char ca[4] = "abc";
- // compiler can't deduce this for some reason:
- //check_wrap(wrap(ca), ca);
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- check_wrap(wrap(a), a);
- check_make_pair(test::make_pair(a, a), a, a);
-#endif
-
- // cv-qualifiers applied to reference types should have no effect
- // declare these here for later use with is_reference and remove_reference:
- typedef int& r_type;
- typedef const r_type cr_type;
-
- type_test(comparible_UDT, boost::call_traits::value_type)
- type_test(comparible_UDT&, boost::call_traits::reference)
- type_test(const comparible_UDT&, boost::call_traits::const_reference)
- type_test(const comparible_UDT&, boost::call_traits::param_type)
- type_test(int, boost::call_traits::value_type)
- type_test(int&, boost::call_traits::reference)
- type_test(const int&, boost::call_traits::const_reference)
- type_test(const int, boost::call_traits::param_type)
- type_test(int*, boost::call_traits::value_type)
- type_test(int*&, boost::call_traits::reference)
- type_test(int*const&, boost::call_traits::const_reference)
- type_test(int*const, boost::call_traits::param_type)
-#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
- type_test(int&, boost::call_traits::value_type)
- type_test(int&, boost::call_traits::reference)
- type_test(const int&, boost::call_traits::const_reference)
- type_test(int&, boost::call_traits::param_type)
-#if !(defined(__GNUC__) && (__GNUC__ < 3))
- type_test(int&, boost::call_traits::value_type)
- type_test(int&, boost::call_traits::reference)
- type_test(const int&, boost::call_traits::const_reference)
- type_test(int&, boost::call_traits::param_type)
-#else
- std::cout << "Your compiler cannot instantiate call_traits, skipping four tests (4 errors)" << std::endl;
- failures += 4;
- test_count += 4;
-#endif
- type_test(const int&, boost::call_traits::value_type)
- type_test(const int&, boost::call_traits::reference)
- type_test(const int&, boost::call_traits::const_reference)
- type_test(const int&, boost::call_traits::param_type)
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
- type_test(const int*, boost::call_traits::value_type)
- type_test(int(&)[3], boost::call_traits::reference)
- type_test(const int(&)[3], boost::call_traits::const_reference)
- type_test(const int*const, boost::call_traits::param_type)
- type_test(const int*, boost::call_traits::value_type)
- type_test(const int(&)[3], boost::call_traits::reference)
- type_test(const int(&)[3], boost::call_traits::const_reference)
- type_test(const int*const, boost::call_traits::param_type)
-#else
- std::cout << "You're compiler does not support partial template instantiation, skipping 8 tests (8 errors)" << std::endl;
- failures += 8;
- test_count += 8;
-#endif
-#else
- std::cout << "You're compiler does not support partial template instantiation, skipping 20 tests (20 errors)" << std::endl;
- failures += 20;
- test_count += 20;
-#endif
-
- return check_result(argc, argv);
-}
-
-//
-// define call_traits tests to check that the assertions in the docs do actually work
-// this is an instantiate only set of tests:
-//
-template
-struct call_traits_test
-{
- typedef ::boost::call_traits ct;
- typedef typename ct::param_type param_type;
- typedef typename ct::reference reference;
- typedef typename ct::const_reference const_reference;
- typedef typename ct::value_type value_type;
- static void assert_construct(param_type val);
-};
-
-template
-void call_traits_test::assert_construct(typename call_traits_test::param_type val)
-{
- //
- // this is to check that the call_traits assertions are valid:
- T t(val);
- value_type v(t);
- reference r(t);
- const_reference cr(t);
- param_type p(t);
- value_type v2(v);
- value_type v3(r);
- value_type v4(p);
- reference r2(v);
- reference r3(r);
- const_reference cr2(v);
- const_reference cr3(r);
- const_reference cr4(cr);
- const_reference cr5(p);
- param_type p2(v);
- param_type p3(r);
- param_type p4(p);
-}
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-template
-struct call_traits_test
-{
- typedef ::boost::call_traits ct;
- typedef typename ct::param_type param_type;
- typedef typename ct::reference reference;
- typedef typename ct::const_reference const_reference;
- typedef typename ct::value_type value_type;
- static void assert_construct(param_type val);
-};
-
-template
-void call_traits_test::assert_construct(typename boost::call_traits::param_type val)
-{
- //
- // this is to check that the call_traits assertions are valid:
- T t;
- value_type v(t);
- value_type v5(val);
- reference r = t;
- const_reference cr = t;
- reference r2 = r;
- #ifndef __BORLANDC__
- // C++ Builder buglet:
- const_reference cr2 = r;
- #endif
- param_type p(t);
- value_type v2(v);
- const_reference cr3 = cr;
- value_type v3(r);
- value_type v4(p);
- param_type p2(v);
- param_type p3(r);
- param_type p4(p);
-}
-#endif //BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-//
-// now check call_traits assertions by instantiating call_traits_test:
-template struct call_traits_test;
-template struct call_traits_test;
-template struct call_traits_test;
-#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES)
-template struct call_traits_test;
-template struct call_traits_test;
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-template struct call_traits_test;
-#endif
-#endif
-
-#ifdef BOOST_MSVC
-unsigned int expected_failures = 10;
-#elif defined(__BORLANDC__)
-unsigned int expected_failures = 2;
-#elif defined(__GNUC__)
-unsigned int expected_failures = 4;
-#else
-unsigned int expected_failures = 0;
-#endif
-
-
diff --git a/compressed_pair.htm b/compressed_pair.htm
deleted file mode 100644
index d63af7f..0000000
--- a/compressed_pair.htm
+++ /dev/null
@@ -1,92 +0,0 @@
-
-
-
-
-
-
-Header
-
-
-
-
-
-
-All of the contents of <boost/compressed_pair.hpp> are
-defined inside namespace boost.
-
-The class compressed pair is very similar to std::pair, but if
-either of the template arguments are empty classes, then the
-"empty member optimisation" is applied to compress the
-size of the pair.
-
-template <class T1, class T2>
-class compressed_pair
-{
-public:
- typedef T1 first_type;
- typedef T2 second_type;
- typedef typename call_traits<first_type>::param_type first_param_type;
- typedef typename call_traits<second_type>::param_type second_param_type;
- typedef typename call_traits<first_type>::reference first_reference;
- typedef typename call_traits<second_type>::reference second_reference;
- typedef typename call_traits<first_type>::const_reference first_const_reference;
- typedef typename call_traits<second_type>::const_reference second_const_reference;
-
- compressed_pair() : base() {}
- compressed_pair(first_param_type x, second_param_type y);
- explicit compressed_pair(first_param_type x);
- explicit compressed_pair(second_param_type y);
-
- first_reference first();
- first_const_reference first() const;
-
- second_reference second();
- second_const_reference second() const;
-
- void swap(compressed_pair& y);
-};
-
-The two members of the pair can be accessed using the member
-functions first() and second(). Note that not all member
-functions can be instantiated for all template parameter types.
-In particular compressed_pair can be instantiated for reference
-and array types, however in these cases the range of constructors
-that can be used are limited. If types T1 and T2 are the same
-type, then there is only one version of the single-argument
-constructor, and this constructor initialises both values in the
-pair to the passed value.
-
-Note that compressed_pair can not be instantiated if either of
-the template arguments is an enumerator type, unless there is
-compiler support for boost::is_enum, or if boost::is_enum is
-specialised for the enumerator type.
-
-Finally, compressed_pair requires compiler support for partial
-specialisation of class templates - without that support
-compressed_pair behaves just like std::pair.
-
-
-
-Revised 08 March 2000
-
-© Copyright boost.org 2000. Permission to copy, use, modify,
-sell and distribute this document is granted provided this
-copyright notice appears in all copies. This document is provided
-"as is" without express or implied warranty, and with
-no claim as to its suitability for any purpose.
-
-Based on contributions by Steve Cleary, Beman Dawes, Howard
-Hinnant and John Maddock.
-
-Maintained by John
-Maddock, the latest version of this file can be found at www.boost.org, and the boost
-discussion list at www.egroups.com/list/boost.
-
-
-
-
diff --git a/compressed_pair_test.cpp b/compressed_pair_test.cpp
deleted file mode 100644
index cc03544..0000000
--- a/compressed_pair_test.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
- // boost::compressed_pair test program
-
- // (C) Copyright John Maddock 2000. Permission to copy, use, modify, sell and
- // distribute this software is granted provided this copyright notice appears
- // in all copies. This software is provided "as is" without express or implied
- // warranty, and with no claim as to its suitability for any purpose.
-
-// standalone test program for
-// Revised 03 Oct 2000:
-// Enabled tests for VC6.
-
-#include
-#include
-#include
-
-#include
-#include
-
-using namespace boost;
-
-namespace boost {
-#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
-template <> struct is_empty
-{ static const bool value = true; };
-template <> struct is_empty
-{ static const bool value = true; };
-template <> struct is_POD
-{ static const bool value = true; };
-#else
-template <> struct is_empty
-{ enum{ value = true }; };
-template <> struct is_empty
-{ enum{ value = true }; };
-template <> struct is_POD
-{ enum{ value = true }; };
-#endif
-}
-
-struct non_empty1
-{
- int i;
- non_empty1() : i(1){}
- non_empty1(int v) : i(v){}
- friend bool operator==(const non_empty1& a, const non_empty1& b)
- { return a.i == b.i; }
-};
-
-struct non_empty2
-{
- int i;
- non_empty2() : i(3){}
- non_empty2(int v) : i(v){}
- friend bool operator==(const non_empty2& a, const non_empty2& b)
- { return a.i == b.i; }
-};
-
-int main(int argc, char *argv[ ])
-{
- compressed_pair cp1(1, 1.3);
- assert(cp1.first() == 1);
- assert(cp1.second() == 1.3);
- compressed_pair cp1b(2, 2.3);
- assert(cp1b.first() == 2);
- assert(cp1b.second() == 2.3);
- swap(cp1, cp1b);
- assert(cp1b.first() == 1);
- assert(cp1b.second() == 1.3);
- assert(cp1.first() == 2);
- assert(cp1.second() == 2.3);
- compressed_pair cp1c(non_empty1(9));
- assert(cp1c.second() == non_empty2());
- assert(cp1c.first() == non_empty1(9));
- compressed_pair cp1d(non_empty2(9));
- assert(cp1d.second() == non_empty2(9));
- assert(cp1d.first() == non_empty1());
-
- compressed_pair cp1e(cp1);
-
- compressed_pair cp2(2);
- assert(cp2.second() == 2);
- compressed_pair cp3(1);
- assert(cp3.first() ==1);
- compressed_pair cp4;
- compressed_pair cp5;
- compressed_pair cp9(empty_UDT());
- compressed_pair cp10(1);
- assert(cp10.first() == 1);
-#if defined(BOOST_MSVC6_MEMBER_TEMPLATES) || !defined(BOOST_NO_MEMBER_TEMPLATES) || !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
- int i = 0;
- compressed_pair cp6(i,i);
- assert(cp6.first() == i);
- assert(cp6.second() == i);
- assert(&cp6.first() == &i);
- assert(&cp6.second() == &i);
- compressed_pair cp7;
- cp7.first();
- double* pd = cp7.second();
-#endif
- value_test(true, (sizeof(compressed_pair) < sizeof(std::pair)))
- value_test(true, (sizeof(compressed_pair) < sizeof(std::pair)))
- value_test(true, (sizeof(compressed_pair) < sizeof(std::pair)))
- value_test(true, (sizeof(compressed_pair) < sizeof(std::pair)))
- value_test(true, (sizeof(compressed_pair >) < sizeof(std::pair >)))
-
- return check_result(argc, argv);
-}
-
-//
-// instanciate some compressed pairs:
-#ifdef __MWERKS__
-template class compressed_pair;
-template class compressed_pair;
-template class compressed_pair;
-template class compressed_pair;
-template class compressed_pair;
-template class compressed_pair;
-#else
-template class boost::compressed_pair;
-template class boost::compressed_pair;
-template class boost::compressed_pair;
-template class boost::compressed_pair;
-template class boost::compressed_pair;
-template class boost::compressed_pair;
-#endif
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-#ifndef __MWERKS__
-//
-// now some for which only a few specific members can be instantiated,
-// first references:
-template double& compressed_pair::first();
-template int& compressed_pair::second();
-#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95))
-template compressed_pair::compressed_pair(int&);
-#endif
-template compressed_pair::compressed_pair(call_traits::param_type,int&);
-//
-// and then arrays:
-#ifndef __BORLANDC__
-template call_traits::reference compressed_pair::second();
-#endif
-template call_traits::reference compressed_pair::first();
-#if !(defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ < 95))
-template compressed_pair::compressed_pair(call_traits::param_type);
-#endif
-template compressed_pair::compressed_pair();
-#endif // __MWERKS__
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-#ifdef __BORLANDC__
-// can't handle both types empty:
-unsigned int expected_failures = 4;
-#elif defined(__GNUC__)
-// no zero sized base classes:
-unsigned int expected_failures = 4;
-#else
-unsigned int expected_failures = 0;
-#endif
-
-
-
-
diff --git a/counting_iterator.htm b/counting_iterator.htm
deleted file mode 100644
index e337044..0000000
--- a/counting_iterator.htm
+++ /dev/null
@@ -1,325 +0,0 @@
-
-
-
-
-
-
-Counting Iterator Adaptor Documentation
-
-
-
-
-
-
-Counting Iterator Adaptor
-
-Defined in header
-boost/counting_iterator.hpp
-
-
-How would you fill up a vector with the numbers zero
-through one hundred using std::copy()? The
-only iterator operation missing from builtin integer types is an
-operator*() that returns the current
-value of the integer. The counting iterator adaptor adds this crucial piece of
-functionality to whatever type it wraps. One can use the
-counting iterator adaptor not only with integer types, but with any
-type that is Incrementable (see type requirements below). The
-following pseudo-code shows the general idea of how the
-counting iterator is implemented.
-
-
-
- // inside a hypothetical counting_iterator class...
- typedef Incrementable value_type;
- value_type counting_iterator::operator*() const {
- return this->base; // no dereference!
- }
-
-
-All of the other operators of the counting iterator behave in the same
-fashion as the Incrementable base type.
-
-Synopsis
-
-
-namespace boost {
- template <class Incrementable>
- struct counting_iterator_traits;
-
- template <class Incrementable>
- struct counting_iterator_generator;
-
- template <class Incrementable>
- typename counting_iterator_generator<Incrementable>::type
- make_counting_iterator(Incrementable x);
-}
-
-
-
-
-
-
-The class template counting_iterator_generator<Incrementable> is a type generator for counting iterators.
-
-
-template <class Incrementable>
-class counting_iterator_generator
-{
-public:
- typedef iterator_adaptor<...> type;
-};
-
-
-Example
-
-In this example we use the counting iterator generator to create a
-counting iterator, and count from zero to four.
-
-
-#include <boost/config.hpp>
-#include <iostream>
-#include <boost/counting_iterator.hpp>
-
-int main(int, char*[])
-{
- // Example of using counting_iterator_generator
- std::cout << "counting from 0 to 4:" << std::endl;
- boost::counting_iterator_generator<int>::type first(0), last(4);
- std::copy(first, last, std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
-
- // to be continued...
-
-The output from this part is:
-
-counting from 0 to 4:
-0 1 2 3
-
-
-Template Parameters
-
-
-
-Parameter | Description |
-
-
-
-Incrementable |
-The type being wrapped by the adaptor. |
-
-
-
-
-Model of
-
-If the Incrementable type has all of the functionality of a
-Random
-Access Iterator except the operator*(), then the counting
-iterator will be a model of Random
-Access Iterator. If the Incrementable type has less
-functionality, then the counting iterator will have correspondingly
-less functionality.
-
-
-
-The Incrementable type must be Default
-Constructible, Copy
-Constructible, and Assignable.
-Also, the Incrementable type must provide access to an
-associated difference_type and iterator_category
-through the counting_iterator_traits
-class.
-
-
-Furthermore, if you wish to create a counting iterator that is a Forward
-Iterator, then the following expressions must be valid:
-
-Incrementable i, j;
-++i // pre-increment
-i == j // operator equal
-
-If you wish to create a counting iterator that is a
-Bidirectional Iterator, then pre-decrement is also required:
-
---i
-
-If you wish to create a counting iterator that is a Random
-Access Iterator, then these additional expressions are also required:
-
-counting_iterator_traits<Incrementable>::difference_type n;
-i += n
-n = i - j
-i < j
-
-
-
-
-Members
-
-The counting iterator type implements the member functions and
-operators required of the Random
-Access Iterator concept. In addition it has the following
-constructor:
-
-
-counting_iterator_generator::type(const Incrementable& i)
-
-
-
-
-
-
-
-
-
-
-template <class Incrementable>
-typename counting_iterator_generator<Incrementable>::type
-make_counting_iterator(Incrementable base);
-
-
-An object
-generator function that provides a convenient way to create counting
-iterators.
-
-
-
-
Example
-
-In this example we count from negative five to positive five, this
-time using the make_counting_iterator() function to save some
-typing.
-
-
- // continuing from previous example...
-
- std::cout << "counting from -5 to 4:" << std::endl;
- std::copy(boost::make_counting_iterator(-5),
- boost::make_counting_iterator(5),
- std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
-
- // to be continued...
-
-The output from this part is:
-
-counting from -5 to 4:
--5 -4 -3 -2 -1 0 1 2 3 4
-
-
-In the next example we create an array of numbers, and then create a
-second array of pointers, where each pointer is the address of a
-number in the first array. The counting iterator makes it easy to do
-this since dereferencing a counting iterator that is wrapping an
-iterator over the array of numbers just returns a pointer to the
-current location in the array. We then use the indirect iterator adaptor to print
-out the number in the array by accessing the numbers through the array
-of pointers.
-
-
- // continuing from previous example...
-
- const int N = 7;
- std::vector<int> numbers;
- // Fill "numbers" array with [0,N)
- std::copy(boost::make_counting_iterator(0), boost::make_counting_iterator(N),
- std::back_inserter(numbers));
-
- std::vector<std::vector<int>::iterator> pointers;
-
- // Use counting iterator to fill in the array of pointers.
- std::copy(boost::make_counting_iterator(numbers.begin()),
- boost::make_counting_iterator(numbers.end()),
- std::back_inserter(pointers));
-
- // Use indirect iterator to print out numbers by accessing
- // them through the array of pointers.
- std::cout << "indirectly printing out the numbers from 0 to "
- << N << std::endl;
- std::copy(boost::make_indirect_iterator(pointers.begin()),
- boost::make_indirect_iterator(pointers.end()),
- std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
-
-The output is:
-
-indirectly printing out the numbers from 0 to 7
-0 1 2 3 4 5 6
-
-
-
-
-
-
-The counting iterator adaptor needs to determine the appropriate
-difference_type and iterator_category to use based on the
-Incrementable type supplied by the user. The
-counting_iterator_traits class provides these types. If the
-Incrementable type is an integral type or an iterator, these types
-will be correctly deduced by the counting_iterator_traits provided by
-the library. Otherwise, the user must specialize
-counting_iterator_traits for her type or add nested typedefs to
-her type to fulfill the needs of
-
-std::iterator_traits.
-
-The following pseudocode describes how the counting_iterator_traits are determined:
-
-
-template <class Incrementable>
-struct counting_iterator_traits
-{
- if (numeric_limits<Incrementable>::is_specialized) {
- if (!numeric_limits<Incrementable>::is_integral)
- COMPILE_TIME_ERROR;
-
- if (!numeric_limits<Incrementable>::is_bounded
- && numeric_limits<Incrementable>::is_signed) {
- typedef Incrementable difference_type;
- }
- else if (numeric_limits<Incrementable>::is_integral) {
- typedef next-larger-signed-type-or-intmax_t difference_type;
- }
- typedef std::random_access_iterator_tag iterator_category;
- } else {
- typedef std::iterator_traits<Incrementable>::difference_type difference_type;
- typedef std::iterator_traits<Incrementable>::iterator_category iterator_category;
- }
-};
-
-
-The italicized sections above are implementation details, but it is important
-to know that the difference_type for integral types is selected so that
-it can always represent the difference between two values if such a built-in
-integer exists. On platforms with a working std::numeric_limits
-implementation, the difference_type for any variable-length signed
-integer type T is T itself.
-
-
-Revised 15 Feb 2001
-© Copyright Jeremy Siek 2000. Permission to copy, use,
-modify, sell and distribute this document is granted provided this copyright
-notice appears in all copies. This document is provided "as is"
-without express or implied warranty, and with no claim as to its suitability for
-any purpose.
-
-
-
-
-
-
-
diff --git a/counting_iterator_example.cpp b/counting_iterator_example.cpp
deleted file mode 100644
index 9513c06..0000000
--- a/counting_iterator_example.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// (C) Copyright Jeremy Siek 2000. Permission to copy, use, modify, sell and
-// distribute this software is granted provided this copyright notice appears
-// in all copies. This software is provided "as is" without express or implied
-// warranty, and with no claim as to its suitability for any purpose.
-
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-int main(int, char*[])
-{
- // Example of using counting_iterator_generator
- std::cout << "counting from 0 to 4:" << std::endl;
- boost::counting_iterator_generator::type first(0), last(4);
- std::copy(first, last, std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
- // Example of using make_counting_iterator()
- std::cout << "counting from -5 to 4:" << std::endl;
- std::copy(boost::make_counting_iterator(-5),
- boost::make_counting_iterator(5),
- std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
- // Example of using counting iterator to create an array of pointers.
- const int N = 7;
- std::vector numbers;
- // Fill "numbers" array with [0,N)
- std::copy(boost::make_counting_iterator(0), boost::make_counting_iterator(N),
- std::back_inserter(numbers));
-
- std::vector::iterator> pointers;
-
- // Use counting iterator to fill in the array of pointers.
- std::copy(boost::make_counting_iterator(numbers.begin()),
- boost::make_counting_iterator(numbers.end()),
- std::back_inserter(pointers));
-
- // Use indirect iterator to print out numbers by accessing
- // them through the array of pointers.
- std::cout << "indirectly printing out the numbers from 0 to "
- << N << std::endl;
- std::copy(boost::make_indirect_iterator(pointers.begin()),
- boost::make_indirect_iterator(pointers.end()),
- std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
- return 0;
-}
diff --git a/counting_iterator_test.cpp b/counting_iterator_test.cpp
deleted file mode 100644
index 0032dda..0000000
--- a/counting_iterator_test.cpp
+++ /dev/null
@@ -1,263 +0,0 @@
-// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and
-// distribute this software is granted provided this copyright notice appears in
-// all copies. This software is provided "as is" without express or implied
-// warranty, and with no claim as to its suitability for any purpose.
-//
-// See http://www.boost.org for most recent version including documentation.
-//
-// Revision History
-// 16 Feb 2001 Added a missing const. Made the tests run (somewhat) with
-// plain MSVC again. (David Abrahams)
-// 11 Feb 2001 #if 0'd out use of counting_iterator on non-numeric types in
-// MSVC without STLport, so that the other tests may proceed
-// (David Abrahams)
-// 04 Feb 2001 Added use of iterator_tests.hpp (David Abrahams)
-// 28 Jan 2001 Removed not_an_iterator detritus (David Abrahams)
-// 24 Jan 2001 Initial revision (David Abrahams)
-
-#include
-#ifdef BOOST_MSVC
-# pragma warning(disable:4786) // identifier truncated in debug info
-#endif
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifndef BOOST_NO_LIMITS
-# include
-#endif
-#ifndef BOOST_NO_SLIST
-# include
-#endif
-
-template struct is_numeric
-{
- enum { value =
-#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
- std::numeric_limits::is_specialized
-#else
- // Causes warnings with GCC, but how else can I detect numeric types at
- // compile-time?
- (boost::is_convertible::value &&
- boost::is_convertible::value)
-#endif
- };
-};
-
-// Special tests for RandomAccess CountingIterators.
-template
-void category_test(
- CountingIterator start,
- CountingIterator finish,
- std::random_access_iterator_tag)
-{
- typedef typename
- boost::detail::iterator_traits::difference_type
- difference_type;
- difference_type distance = boost::detail::distance(start, finish);
-
- // Pick a random position internal to the range
- difference_type offset = (unsigned)rand() % distance;
- assert(offset >= 0);
- CountingIterator internal = start;
- std::advance(internal, offset);
-
- // Try some binary searches on the range to show that it's ordered
- assert(std::binary_search(start, finish, *internal));
- CountingIterator x,y;
- boost::tie(x,y) = std::equal_range(start, finish, *internal);
- assert(boost::detail::distance(x, y) == 1);
-
- // Show that values outside the range can't be found
- assert(!std::binary_search(start, boost::prior(finish), *finish));
-
- // Do the generic random_access_iterator_test
- typedef typename CountingIterator::value_type value_type;
- std::vector v;
- for (value_type z = *start; z != *finish; ++z)
- v.push_back(z);
- if (v.size() >= 2)
- {
- // Note that this test requires a that the first argument is
- // dereferenceable /and/ a valid iterator prior to the first argument
- boost::random_access_iterator_test(start + 1, v.size() - 1, v.begin() + 1);
- }
-}
-
-// Special tests for bidirectional CountingIterators
-template
-void category_test(CountingIterator start, CountingIterator finish, std::bidirectional_iterator_tag)
-{
- if (finish != start
- && finish != boost::next(start)
- && finish != boost::next(boost::next(start)))
- {
- // Note that this test requires a that the first argument is
- // dereferenceable /and/ a valid iterator prior to the first argument
- boost::bidirectional_iterator_test(boost::next(start), boost::next(*start), boost::next(boost::next(*start)));
- }
-}
-
-template
-void category_test(CountingIterator start, CountingIterator finish, std::forward_iterator_tag)
-{
- if (finish != start && finish != boost::next(start))
- boost::forward_iterator_test(start, *start, boost::next(*start));
-}
-
-template
-void test_aux(CountingIterator start, CountingIterator finish)
-{
- typedef typename CountingIterator::iterator_category category;
- typedef typename CountingIterator::value_type value_type;
-
- // If it's a RandomAccessIterator we can do a few delicate tests
- category_test(start, finish, category());
-
- // Okay, brute force...
- for (CountingIterator p = start; p != finish && boost::next(p) != finish; ++p)
- {
- assert(boost::next(*p) == *boost::next(p));
- }
-
- // prove that a reference can be formed to these values
- typedef typename CountingIterator::value_type value;
- const value* q = &*start;
- (void)q; // suppress unused variable warning
-}
-
-template
-void test(Incrementable start, Incrementable finish)
-{
- test_aux(boost::make_counting_iterator(start), boost::make_counting_iterator(finish));
-}
-
-template
-void test_integer(Integer* = 0) // default arg works around MSVC bug
-{
- Integer start = 0;
- Integer finish = 120;
- test(start, finish);
-}
-
-template
-void test_container(Container* = 0) // default arg works around MSVC bug
-{
- Container c(1 + (unsigned)rand() % 1673);
-
- const typename Container::iterator start = c.begin();
-
- // back off by 1 to leave room for dereferenceable value at the end
- typename Container::iterator finish = start;
- std::advance(finish, c.size() - 1);
-
- test(start, finish);
-
- typedef typename Container::const_iterator const_iterator;
- test(const_iterator(start), const_iterator(finish));
-}
-
-class my_int1 {
-public:
- my_int1() { }
- my_int1(int x) : m_int(x) { }
- my_int1& operator++() { ++m_int; return *this; }
- bool operator==(const my_int1& x) const { return m_int == x.m_int; }
-private:
- int m_int;
-};
-
-namespace boost {
- template <>
- struct counting_iterator_traits {
- typedef std::ptrdiff_t difference_type;
- typedef std::forward_iterator_tag iterator_category;
- };
-}
-
-class my_int2 {
-public:
- typedef void value_type;
- typedef void pointer;
- typedef void reference;
- typedef std::ptrdiff_t difference_type;
- typedef std::bidirectional_iterator_tag iterator_category;
-
- my_int2() { }
- my_int2(int x) : m_int(x) { }
- my_int2& operator++() { ++m_int; return *this; }
- my_int2& operator--() { --m_int; return *this; }
- bool operator==(const my_int2& x) const { return m_int == x.m_int; }
-private:
- int m_int;
-};
-
-class my_int3 {
-public:
- typedef void value_type;
- typedef void pointer;
- typedef void reference;
- typedef std::ptrdiff_t difference_type;
- typedef std::random_access_iterator_tag iterator_category;
-
- my_int3() { }
- my_int3(int x) : m_int(x) { }
- my_int3& operator++() { ++m_int; return *this; }
- my_int3& operator+=(std::ptrdiff_t n) { m_int += n; return *this; }
- std::ptrdiff_t operator-(const my_int3& x) const { return m_int - x.m_int; }
- my_int3& operator--() { --m_int; return *this; }
- bool operator==(const my_int3& x) const { return m_int == x.m_int; }
- bool operator!=(const my_int3& x) const { return m_int != x.m_int; }
- bool operator<(const my_int3& x) const { return m_int < x.m_int; }
-private:
- int m_int;
-};
-
-int main()
-{
- // Test the built-in integer types.
- test_integer();
- test_integer();
- test_integer();
- test_integer();
- test_integer();
- test_integer();
- test_integer();
- test_integer();
- test_integer();
- test_integer();
-#if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)
- test_integer();
- test_integer();
-#endif
-
- // wrapping an iterator or non-built-in integer type causes an INTERNAL
- // COMPILER ERROR in MSVC without STLport. I'm clueless as to why.
-#if !defined(BOOST_MSVC) || defined(__SGI_STL_PORT)
- // Test user-defined type.
- test_integer();
- test_integer();
- test_integer();
-
- // Some tests on container iterators, to prove we handle a few different categories
- test_container >();
- test_container >();
-# ifndef BOOST_NO_SLIST
- test_container >();
-# endif
-
- // Also prove that we can handle raw pointers.
- int array[2000];
- test(boost::make_counting_iterator(array), boost::make_counting_iterator(array+2000-1));
-#endif
- std::cout << "test successful " << std::endl;
- return 0;
-}
diff --git a/filter_iterator.htm b/filter_iterator.htm
deleted file mode 100644
index fe5f10c..0000000
--- a/filter_iterator.htm
+++ /dev/null
@@ -1,273 +0,0 @@
-
-
-
-
-
-
-Filter Iterator Adaptor Documentation
-
-
-
-
-
-
-Filter Iterator Adaptor
-
-Defined in header
-boost/iterator_adaptors.hpp
-
-
-
-The filter iterator adaptor creates a view of an iterator range in
-which some elements of the range are skipped over. A Predicate
-function object controls which elements are skipped. When the
-predicate is applied to an element, if it returns true then
-the element is retained and if it returns false then the
-element is skipped over.
-
-
-
Synopsis
-
-
-namespace boost {
- template <class Predicate, class BaseIterator, ...>
- class filter_iterator_generator;
-
- template <class Predicate, class BaseIterator>
- typename filter_iterator_generator<Predicate, BaseIterator>::type
- make_filter_iterator(BaseIterator first, BaseIterator last, const Predicate& p = Predicate());
-}
-
-
-
-
-
-
-The class filter_iterator_generator is a helper class whose
-purpose is to construct a filter iterator type. The template
-parameters for this class are the Predicate function object
-type and the BaseIterator type that is being wrapped. In
-most cases the associated types for the wrapped iterator can be
-deduced from std::iterator_traits, but in some situations the
-user may want to override these types, so there are also template
-parameters for each of the iterator's associated types.
-
-
-template <class Predicate, class BaseIterator,
- class Value, class Reference, class Pointer, class Category, class Distance>
-class filter_iterator_generator
-{
-public:
- typedef iterator_adaptor<...> type; // the resulting filter iterator type
-}
-
-
-
-Example
-
-The following example uses filter iterator to print out all the
-positive integers in an array.
-
-
-struct is_positive_number {
- bool operator()(int x) { return 0 < x; }
-};
-int main() {
- int numbers[] = { 0, -1, 4, -3, 5, 8, -2 };
- const int N = sizeof(numbers)/sizeof(int);
-
- typedef boost::filter_iterator_generator<is_positive_number, int*, int>::type FilterIter;
- is_positive_number predicate;
- FilterIter::policies_type policies(predicate, numbers + N);
- FilterIter filter_iter_first(numbers, policies);
- FilterIter filter_iter_last(numbers + N, policies);
-
- std::copy(filter_iter_first, filter_iter_last, std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- return 0;
-}
-
-The output is:
-
-4 5 8
-
-
-
-Template Parameters
-
-
-
-Parameter | Description |
-
-
-
-Predicate |
-The function object that determines which elements are retained and which elements are skipped.
- |
-
-
-BaseIterator |
-The iterator type being wrapped. This type must at least be a model
- of the InputIterator concept. |
-
-
-
-Value |
-The value_type of the resulting iterator,
-unless const. If const, a conforming compiler strips constness for the
-value_type. Typically the default for this parameter is the
-appropriate type[1]. Default:
-std::iterator_traits<BaseIterator>::value_type |
-
-
-
-Reference |
-The reference type of the resulting iterator, and in
-particular, the result type of operator*(). Typically the default for
-this parameter is the appropriate type. Default: If
-Value is supplied, Value& is used. Otherwise
-std::iterator_traits<BaseIterator>::reference is
-used. |
-
-
-
-Pointer |
-The pointer type of the resulting iterator, and in
- particular, the result type of operator->().
- Typically the default for
-this parameter is the appropriate type.
-Default: If Value was supplied, then Value*,
-otherwise std::iterator_traits<BaseIterator>::pointer. |
-
-
-
-
-Category |
-The iterator_category type for the resulting iterator.
-Typically the
-default for this parameter is the appropriate type. If you override
-this parameter, do not use bidirectional_iterator_tag
-because filter iterators can not go in reverse.
-Default: std::iterator_traits<BaseIterator>::iterator_category |
-
-
-
-Distance |
-The difference_type for the resulting iterator. Typically the default for
-this parameter is the appropriate type.
-Default: std::iterator_traits<BaseIterator>::difference_type |
-
-
-
-
-
-Model of
-
-The filter iterator adaptor (the type
-filter_iterator_generator<...>::type) may be a model of InputIterator or ForwardIterator
-depending on the adapted iterator type.
-
-
-Members
-
-The filter iterator type implements all of the member functions and
-operators required of the ForwardIterator
-concept. In addition it has the following constructor:
-
-filter_iterator_generator::type(const BaseIterator& it, const Policies& p = Policies())
-
-
-The policies type has only one public function, which is its constructor:
-
-
filter_iterator_generator::policies_type(const Predicate& p, const BaseIterator& end)
-
-
-
-
-
-
-
-
-template <class Predicate, class BaseIterator>
-typename detail::filter_generator<Predicate, BaseIterator>::type
-make_filter_iterator(BaseIterator first, BaseIterator last, const Predicate& p = Predicate())
-
-
-This function provides a convenient way to create filter iterators.
-
-Example
-
-In this example we print out all numbers in the array that are
-greater than negative two.
-
-
-int main()
-{
- int numbers[] = { 0, -1, 4, -3, 5, 8, -2 };
- const int N = sizeof(numbers)/sizeof(int);
-
- std::copy(boost::make_filter_iterator(numbers, numbers + N,
- std::bind2nd(std::greater(), -2)),
- boost::make_filter_iterator(numbers + N, numbers + N,
- std::bind2nd(std::greater(), -2)),
- std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
-}
-
-The output is:
-
-0 -1 4 5 8
-
-
-
-In the next example we print the positive numbers using the
-make_filter_iterator() function.
-
-
-struct is_positive_number {
- bool operator()(int x) { return 0 < x; }
-};
-int main()
-{
- int numbers[] = { 0, -1, 4, -3, 5, 8, -2 };
- const int N = sizeof(numbers)/sizeof(int);
-
- std::copy(boost::make_filter_iterator<is_positive_number>(numbers, numbers + N),
- boost::make_filter_iterator<is_positive_number>(numbers + N, numbers + N),
- std::ostream_iterator<int>(std::cout, " "));
- std::cout << std::endl;
- return 0;
-}
-
-The output is:
-
-4 5 8
-
-
-
-Notes
-
-[1] If the compiler does not support partial
-specialization and the wrapped iterator type is a builtin pointer then
-the Value type must be explicitly specified (don't use the
-default).
-
-
-
-Revised 10 Feb 2001
-© Copyright Jeremy Siek 2000. Permission to copy, use,
-modify, sell and distribute this document is granted provided this copyright
-notice appears in all copies. This document is provided "as is"
-without express or implied warranty, and with no claim as to its suitability for
-any purpose.
-
-
-
-
diff --git a/filter_iterator_example.cpp b/filter_iterator_example.cpp
deleted file mode 100644
index 6ca0605..0000000
--- a/filter_iterator_example.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Example of using the filter iterator adaptor from
-// boost/iterator_adaptors.hpp.
-
-// (C) Copyright Jeremy Siek 1999. Permission to copy, use, modify,
-// sell and distribute this software is granted provided this
-// copyright notice appears in all copies. This software is provided
-// "as is" without express or implied warranty, and with no claim as
-// to its suitability for any purpose.
-
-
-#include
-#include
-#include
-#include
-#include
-
-struct is_positive_number {
- bool operator()(int x) { return 0 < x; }
-};
-
-int main()
-{
- int numbers[] = { 0, -1, 4, -3, 5, 8, -2 };
- const int N = sizeof(numbers)/sizeof(int);
-
- // Example using make_filter_iterator()
- std::copy(boost::make_filter_iterator(numbers, numbers + N),
- boost::make_filter_iterator(numbers + N, numbers + N),
- std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
- // Example using filter_iterator_generator
- typedef boost::filter_iterator_generator::type
- FilterIter;
- is_positive_number predicate;
- FilterIter::policies_type policies(predicate, numbers + N);
- FilterIter filter_iter_first(numbers, policies);
- FilterIter filter_iter_last(numbers + N, policies);
-
- std::copy(filter_iter_first, filter_iter_last, std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
- // Another example using make_filter_iterator()
- std::copy(boost::make_filter_iterator(numbers, numbers + N,
- std::bind2nd(std::greater(), -2)),
- boost::make_filter_iterator(numbers + N, numbers + N,
- std::bind2nd(std::greater(), -2)),
- std::ostream_iterator(std::cout, " "));
- std::cout << std::endl;
-
-
- return 0;
-}
diff --git a/half_open_range_test.cpp b/half_open_range_test.cpp
deleted file mode 100644
index 04c2e97..0000000
--- a/half_open_range_test.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-// (C) Copyright David Abrahams 2001. Permission to copy, use, modify, sell and
-// distribute this software is granted provided this copyright notice appears in
-// all copies. This software is provided "as is" without express or implied
-// warranty, and with no claim as to its suitability for any purpose.
-//
-// See http://www.boost.org for most recent version including documentation.
-//
-// Revision History
-// 11 Feb 2001 Compile with Borland, re-enable failing tests (David Abrahams)
-// 29 Jan 2001 Initial revision (David Abrahams)
-
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#ifndef BOOST_NO_LIMITS
-# include
-#endif
-#ifndef BOOST_NO_SLIST
-# include
-#endif
-
-inline unsigned unsigned_random(unsigned max)
-{
- return (max > 0) ? (unsigned)rand() % max : 0;
-}
-
-// Special tests for ranges supporting random access
-template
-void category_test_1(
- const boost::half_open_range& r, std::random_access_iterator_tag)
-{
- typedef boost::half_open_range range;
- typedef typename range::size_type size_type;
- size_type size = r.size();
-
- // pick a random offset
- size_type offset = unsigned_random(size);
-
- typename range::value_type x = *(r.begin() + offset);
- // test contains(value_type)
- assert(r.contains(r.start()) == !r.empty());
- assert(!r.contains(r.finish()));
- assert(r.contains(x) == (offset != size));
-
- range::const_iterator p = r.find(x);
- assert((p == r.end()) == (x == r.finish()));
- assert(r.find(r.finish()) == r.end());
-
- if (offset != size)
- {
- assert(x == r[offset]);
- assert(x == r.at(offset));
- }
-
- bool caught_out_of_range = false;
- try {
- bool never_initialized = x == r.at(size);
- (void)never_initialized;
- }
- catch(std::out_of_range&)
- {
- caught_out_of_range = true;
- }
- catch(...)
- {
- }
- assert(caught_out_of_range);
-}
-
-// Those tests must be skipped for other ranges
-template
-void category_test_1(
- const boost::half_open_range&, std::forward_iterator_tag)
-{
-}
-
-unsigned indices[][2] = { {0,0},{0,1},{0,2},{0,3},
- {1,1},{1,2},{1,3},
- {2,2},{2,3},
- {3,3}};
-
-template
-void category_test_2(
- const std::vector& ranges, unsigned i, unsigned j, std::random_access_iterator_tag)
-{
- typedef Range range;
- const range& ri = ranges[i];
- const range& rj = ranges[j];
-
- if (indices[i][0] <= indices[j][0] && indices[i][1] >= indices[j][1])
- assert(ri.contains(rj));
-
- if (ri.contains(rj))
- assert((ri & rj) == rj);
- assert(boost::intersects(ri, rj) == !(ri & rj).empty());
-
- range t1(ri);
- t1 &= rj;
- assert(t1 == range(indices[i][0] > indices[j][0] ? ri.start() : rj.start(),
- indices[i][1] < indices[j][1] ? ri.finish() : rj.finish()));
- assert(t1 == (ri & rj));
-
- range t2(ri);
- t2 |= rj;
-
- if (ri.empty())
- assert(t2 == rj);
- else if (rj.empty())
- assert(t2 == ri);
- else
- assert(t2 == range(indices[i][0] < indices[j][0] ? ri.start() : rj.start(),
- indices[i][1] > indices[j][1] ? ri.finish() : rj.finish()));
- assert(t2 == (ri | rj));
- if (i == j)
- assert(ri == rj);
-
- if (ri.empty() || rj.empty())
- assert((ri == rj) == (ri.empty() && rj.empty()));
- else
- assert((ri == rj) == (ri.start() == rj.start() && ri.finish() == rj.finish()));
-
- assert((ri == rj) == !(ri != rj));
-
- bool same = ri == rj;
- bool one_empty = ri.empty() != rj.empty();
-
- std::less