diff --git a/development/boost/iterator_categories.hpp b/development/boost/iterator_categories.hpp deleted file mode 100644 index 138a5be..0000000 --- a/development/boost/iterator_categories.hpp +++ /dev/null @@ -1,159 +0,0 @@ -#ifndef BOOST_ITERATOR_CATEGORIES_HPP -#define BOOST_ITERATOR_CATEGORIES_HPP - -#include -#include -#include -#include -#include - -namespace boost { - - // Return Type Categories - struct readable_iterator_tag { }; - struct writable_iterator_tag { }; - struct swappable_iterator_tag { }; - struct mutable_lvalue_iterator_tag : - virtual public writable_iterator_tag, - virtual public readable_iterator_tag { }; - struct constant_lvalue_iterator_tag : - virtual public readable_iterator_tag { }; - - // Traversal Categories - struct forward_traversal_tag { }; - struct bidirectional_traversal_tag : public forward_traversal_tag { }; - struct random_access_traversal_tag : public bidirectional_traversal_tag { }; - - struct error_iterator_tag { }; - - // Inherit from iterator_base if your iterator defines its own - // return_category and traversal_category. Otherwise, the "old style" - // iterator category will be mapped to the return_category and - // traversal_category. - struct new_iterator_base { }; - - namespace detail { - - struct return_category_from_nested_type { - template struct bind { - typedef typename Iterator::return_category type; - }; - }; - - struct traversal_category_from_nested_type { - template struct bind { - typedef typename Iterator::traversal_category type; - }; - }; - - template - struct choose_lvalue_return { - typedef typename ct_if::value, - boost::constant_lvalue_iterator_tag, - boost::mutable_lvalue_iterator_tag>::type type; - }; - - - template - struct iter_category_to_return { - typedef typename ct_if< - is_convertible::value, - typename choose_lvalue_return::type, - typename ct_if< - is_convertible::value, - boost::readable_iterator_tag, - typename ct_if< - is_convertible::value, - boost::writable_iterator_tag, - boost::error_iterator_tag - >::type - >::type - >::type type; - }; - - template - struct iter_category_to_traversal { - typedef typename ct_if< - is_convertible::value, - random_access_traversal_tag, - typename ct_if< - is_convertible::value, - bidirectional_traversal_tag, - forward_traversal_tag - >::type - >::type type; - }; - - struct return_category_from_old_traits { - template class bind { - typedef boost::detail::iterator_traits OldTraits; - typedef typename OldTraits::iterator_category Cat; - typedef typename OldTraits::value_type value_type; - public: - typedef iter_category_to_return::type type; - }; - }; - - struct traversal_category_from_old_traits { - template class bind { - typedef boost::detail::iterator_traits OldTraits; - typedef typename OldTraits::iterator_category Cat; - public: - typedef iter_category_to_traversal::type type; - }; - }; - - template - class choose_return_category { - typedef typename ct_if::value, - return_category_from_nested_type, - return_category_from_old_traits>::type Choice; - public: - typedef typename Choice:: template bind::type type; - }; - - template - class choose_traversal_category { - typedef typename ct_if::value, - traversal_category_from_nested_type, - traversal_category_from_old_traits>::type Choice; - public: - typedef typename Choice:: template bind::type type; - }; - - } // namespace detail - - template - struct return_category { - typedef typename detail::choose_return_category::type type; - }; - - - template - struct traversal_category { - typedef typename detail::choose_traversal_category::type type; - }; - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - template - struct return_category - { - typedef typename ct_if::value, - constant_lvalue_iterator_tag, - mutable_lvalue_iterator_tag>::type type; - }; - - template - struct traversal_category - { - typedef random_access_traversal_tag type; - }; - -#endif - -} // namespace boost - -#endif // BOOST_ITERATOR_CATEGORIES_HPP diff --git a/development/boost/iterator_concepts.hpp b/development/boost/iterator_concepts.hpp deleted file mode 100644 index a30ff17..0000000 --- a/development/boost/iterator_concepts.hpp +++ /dev/null @@ -1,172 +0,0 @@ -#ifndef BOOST_ITERATOR_CONCEPTS_HPP -#define BOOST_ITERATOR_CONCEPTS_HPP - -#include -#include -#include -#include - -namespace boost_concepts { - // Used a different namespace here (instead of "boost") so that the - // concept descriptions do not take for granted the names in - // namespace boost. - - - //=========================================================================== - // Iterator Access Concepts - - template - class ReadableIteratorConcept { - public: - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::reference reference; - typedef typename boost::return_category::type return_category; - - void constraints() { - boost::function_requires< boost::SGIAssignableConcept >(); - boost::function_requires< boost::EqualityComparableConcept >(); - boost::function_requires< - boost::DefaultConstructibleConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - - reference r = *i; // or perhaps read(x) - value_type v(r); - boost::ignore_unused_variable_warning(v); - } - Iterator i; - }; - - template - class WritableIteratorConcept { - public: - typedef typename boost::return_category::type return_category; - - void constraints() { - boost::function_requires< boost::SGIAssignableConcept >(); - boost::function_requires< boost::EqualityComparableConcept >(); - boost::function_requires< - boost::DefaultConstructibleConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - - *i = v; // a good alternative could be something like write(x, v) - } - ValueType v; - Iterator i; - }; - - template - class ConstantLvalueIteratorConcept { - public: - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::reference reference; - typedef typename boost::return_category::type return_category; - - void constraints() { - boost::function_requires< ReadableIteratorConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - - BOOST_STATIC_ASSERT((boost::is_same::value)); - - reference v = *i; - boost::ignore_unused_variable_warning(v); - } - Iterator i; - }; - - template - class MutableLvalueIteratorConcept { - public: - typedef typename std::iterator_traits::value_type value_type; - typedef typename std::iterator_traits::reference reference; - typedef typename boost::return_category::type return_category; - - void constraints() { - boost::function_requires< ReadableIteratorConcept >(); - boost::function_requires< - WritableIteratorConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - - BOOST_STATIC_ASSERT((boost::is_same::value)); - - reference v = *i; - boost::ignore_unused_variable_warning(v); - } - Iterator i; - }; - - //=========================================================================== - // Iterator Traversal Concepts - - template - class ForwardIteratorConcept { - public: - typedef typename boost::traversal_category::type traversal_category; - - void constraints() { - boost::function_requires< boost::SGIAssignableConcept >(); - boost::function_requires< boost::EqualityComparableConcept >(); - boost::function_requires< - boost::DefaultConstructibleConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - ++i; - (void)i++; - } - Iterator i; - }; - - template - class BidirectionalIteratorConcept { - public: - typedef typename boost::traversal_category::type traversal_category; - - void constraints() { - boost::function_requires< ForwardIteratorConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - - --i; - (void)i--; - } - Iterator i; - }; - - template - class RandomAccessIteratorConcept { - public: - typedef typename boost::traversal_category::type traversal_category; - typedef typename std::iterator_traits::difference_type - difference_type; - - void constraints() { - boost::function_requires< BidirectionalIteratorConcept >(); - - BOOST_STATIC_ASSERT((boost::is_convertible::value)); - - i += n; - i = i + n; - i = n + i; - i -= n; - i = i - n; - n = i - j; - } - difference_type n; - Iterator i, j; - }; - -} // namespace boost_concepts - - -#endif // BOOST_ITERATOR_CONCEPTS_HPP diff --git a/development/libs/iterator/concept_tests.cpp b/development/libs/iterator/concept_tests.cpp deleted file mode 100644 index f75f311..0000000 --- a/development/libs/iterator/concept_tests.cpp +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include - -struct new_iterator - : public boost::iterator, - public boost::new_iterator_base -{ - typedef boost::random_access_traversal_tag traversal_category; - typedef boost::mutable_lvalue_iterator_tag return_category; - - int& operator*() const { return *m_x; } - new_iterator& operator++() { return *this; } - new_iterator operator++(int) { return *this; } - new_iterator& operator--() { return *this; } - new_iterator operator--(int) { return *this; } - new_iterator& operator+=(std::ptrdiff_t) { return *this; } - new_iterator operator+(std::ptrdiff_t) { return *this; } - new_iterator& operator-=(std::ptrdiff_t) { return *this; } - std::ptrdiff_t operator-(const new_iterator&) const { return 0; } - new_iterator operator-(std::ptrdiff_t) const { return *this; } - bool operator==(const new_iterator&) const { return false; } - bool operator!=(const new_iterator&) const { return false; } - bool operator<(const new_iterator&) const { return false; } - int* m_x; -}; -new_iterator operator+(std::ptrdiff_t, new_iterator x) { return x; } - -struct old_iterator - : public boost::iterator -{ - int& operator*() const { return *m_x; } - old_iterator& operator++() { return *this; } - old_iterator operator++(int) { return *this; } - old_iterator& operator--() { return *this; } - old_iterator operator--(int) { return *this; } - old_iterator& operator+=(std::ptrdiff_t) { return *this; } - old_iterator operator+(std::ptrdiff_t) { return *this; } - old_iterator& operator-=(std::ptrdiff_t) { return *this; } - old_iterator operator-(std::ptrdiff_t) const { return *this; } - std::ptrdiff_t operator-(const old_iterator&) const { return 0; } - bool operator==(const old_iterator&) const { return false; } - bool operator!=(const old_iterator&) const { return false; } - bool operator<(const old_iterator&) const { return false; } - int* m_x; -}; -old_iterator operator+(std::ptrdiff_t, old_iterator x) { return x; } - -int -main() -{ -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - boost::function_requires< - boost_concepts::MutableLvalueIteratorConcept >(); - boost::function_requires< - boost_concepts::RandomAccessIteratorConcept >(); - - boost::function_requires< - boost_concepts::ConstantLvalueIteratorConcept >(); - boost::function_requires< - boost_concepts::RandomAccessIteratorConcept >(); -#endif - - boost::function_requires< - boost_concepts::MutableLvalueIteratorConcept >(); - boost::function_requires< - boost_concepts::RandomAccessIteratorConcept >(); - - boost::function_requires< - boost_concepts::MutableLvalueIteratorConcept >(); - boost::function_requires< - boost_concepts::RandomAccessIteratorConcept >(); - return 0; -} diff --git a/development/libs/iterator/iterator_categories.htm b/development/libs/iterator/iterator_categories.htm deleted file mode 100644 index 83c29e5..0000000 --- a/development/libs/iterator/iterator_categories.htm +++ /dev/null @@ -1,160 +0,0 @@ - - - - Boost Iterator Traits - - - -C++ Boost -
- -

Boost Iterator Category Traits

-Header boost/iterator_categories.hpp - -

-The boost::traversal_category and -boost::return_category traits classes provides access to the -category tags for iterators that model the Boost Iterator Concepts, which are a -replacement for the iterator requirements in the C++ standard. The -other associated types of the Boost iterator concepts are accessed -through the std::iterator_traits class. - -

    -
  • traversal_category<Iter>::type   Can the iterator go forward, backward, etc.? -
  • return_category<Iter>::type   Is the iterator read or write only? - Is the dereferenced type an lvalue? -
- -

-An important feature of the boost::traversal_category and -boost::return_category classes is that they are backwards -compatible, i.e., they automatically work for iterators for which -there are valid definitions of std::iterator_traits. The old -iterator_category is mapped to the appropriate traversal and -return categories. - -

-When creating a new iterator type that is meant to work with -boost::traversal_category and -boost::return_category, you can either create a -specialization of these classes for your iterator type, or you can -provide all the necessary associated types as nested typedefs. In -this case, your iterator class will need to inherit from -new_iterator_base to let the category traits know -that it will be able to find typedefs for traversal_category -and return_category in you iterator class. - - -Each of the new iterator requirements will need a category tag. - -

-namespace boost {
-
-  // Return Type Categories
-  struct readable_iterator_tag { };
-  struct writable_iterator_tag { };
-  struct swappable_iterator_tag { };
-  struct mutable_lvalue_iterator_tag : virtual public writable_iterator_tag,
-    virtual public readable_iterator_tag { };
-  struct constant_lvalue_iterator_tag : public readable_iterator_tag { };
-
-  // Traversal Categories
-  struct forward_traversal_tag { };
-  struct bidirectional_traversal_tag : public forward_traversal_tag { };
-  struct random_access_traversal_tag : public bidirectional_traversal_tag { };
-
-}
-
- -

-The following is pseudo-code for the iterator category traits classes. - -

-namespace boost {
-
-  // Inherit from iterator_base if your iterator defines its own
-  // return_category and traversal_category. Otherwise, the "old style"
-  // iterator category will be mapped to the return_category and
-  // traversal_category.
-  struct new_iterator_base { };
-
-  template <typename Iterator>
-  struct return_category
-  {
-    // Pseudo-code
-    if (Iterator inherits from new_iterator_base) {
-      typedef typename Iterator::return_category type;
-    } else {
-      typedef std::iterator_traits<Iterator> OldTraits;
-      typedef typename OldTraits::iterator_category Cat;
-      if (Cat inherits from std::forward_iterator_tag)
-	if (is-const(T))
-	  typedef boost::constant_lvalue_iterator_tag type;
-	else
-	  typedef boost::mutable_lvalue_iterator_tag type;
-      else if (Cat inherits from std::input_iterator_tag)
-	typedef boost::readable_iterator_tag type;
-      else if (Cat inherits from std::output_iterator_tag)
-	typedef boost::writable_iterator_tag type;
-    }
-  };
-
-  template <typename T>
-  struct return_category<T*>
-  {
-    // Pseudo-code
-    if (is-const(T))
-      typedef boost::constant_lvalue_iterator_tag type;
-    else
-      typedef boost::mutable_lvalue_iterator_tag type;
-  };
-
-  template <typename Iterator>
-  struct traversal_category
-  {
-    // Pseudo-code
-    if (Iterator inherits from new_iterator_base) {
-      typedef typename Iterator::traversal_category type;
-    } else {
-      typedef std::iterator_traits<Iterator> OldTraits;
-      typedef typename OldTraits::iterator_category Cat;
-
-      if (Cat inherits from std::random_access_iterator_tag)
-	typedef boost::random_access_traversal_tag type;
-      else if (Cat inherits from std::bidirectional_iterator_tag)
-	typedef boost::bidirectional_traversal_tag type;
-      else if (Cat inherits from std::forward_iterator_tag)
-	typedef boost::forward_traversal_tag type;
-    }
-  };
-
-  template <typename T>
-  struct traversal_category<T*>
-  {
-    typedef boost::random_access_traversal_tag type;
-  };
-
-}
-
- -
-
jeremy siek
- - -Last modified: Mon Mar 19 12:59:30 EST 2001 - - - diff --git a/development/libs/iterator/iterator_concepts.fig b/development/libs/iterator/iterator_concepts.fig deleted file mode 100644 index 198205e..0000000 --- a/development/libs/iterator/iterator_concepts.fig +++ /dev/null @@ -1,37 +0,0 @@ -#FIG 3.2 -Landscape -Center -Inches -Letter -100.00 -Single --2 -1200 2 -6 150 2325 4275 4350 -2 1 0 1 0 7 100 0 -1 4.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1725 4050 1725 3450 -2 1 0 1 0 7 100 0 -1 4.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 1725 3150 1725 2550 -4 0 0 100 0 19 18 0.0000 4 210 3180 375 2550 ForwardTraversalIterator\001 -4 0 0 100 0 19 18 0.0000 4 210 3765 225 3450 BidirectionalTraversalIterator\001 -4 0 0 100 0 19 18 0.0000 4 210 4125 150 4350 RandomAccessTraversalIterator\001 --6 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 4800 3600 4800 2400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6900 3000 5400 2400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6900 3000 7500 2400 -2 1 0 1 0 7 50 0 -1 0.000 0 0 -1 1 0 2 - 1 1 1.00 60.00 120.00 - 6900 3000 9075 2475 -4 0 0 100 0 19 18 0.0000 4 210 2040 6600 2400 WritableIterator\001 -4 0 0 100 0 19 18 0.0000 4 210 2145 3900 2400 ReadableIterator\001 -4 0 0 50 0 19 18 0.0000 4 210 2835 5700 3300 MutableLvalueIterator\001 -4 0 0 50 0 19 18 0.0000 4 270 2355 9075 2400 SwappableIterator\001 -4 0 0 50 0 19 18 0.0000 4 210 2970 3825 3900 ConstantLvalueIterator\001 diff --git a/development/libs/iterator/iterator_concepts.gif b/development/libs/iterator/iterator_concepts.gif deleted file mode 100644 index bac35c7..0000000 Binary files a/development/libs/iterator/iterator_concepts.gif and /dev/null differ diff --git a/development/libs/iterator/iterator_concepts.htm b/development/libs/iterator/iterator_concepts.htm deleted file mode 100644 index f2f8dcd..0000000 --- a/development/libs/iterator/iterator_concepts.htm +++ /dev/null @@ -1,663 +0,0 @@ - - - - -Iterator Concepts - -C++ Boost - -
- - -

Iterator Concepts

- -

The standard iterator categories and requirements are flawed because -they use a single hierarchy of requirements to address two orthogonal -issues: iterator traversal and dereference return -type. The current iterator requirement hierarchy is mainly -geared towards iterator traversal (hence the category names), while -requirements that address dereference return type sneak in at various -places. - -

-The iterator requirements should be separated into two hierarchies. -One set of concepts handles the return type semantics: -

- -The other set of concepts handles iterator traversal: - - - -The current Input Iterator and Output Iterator requirements will -continue to be used as is. Note that Input Iterator implies Readable -Iterator and Output Iterator implies Writable Iterator. - -

-Note: we considered defining a Single-Pass Iterator, which could be -combined with Readable or Writable Iterator to replace the Input and -Output Iterator requirements. We rejected this idea because there are -some differences between Input and Output Iterators that make it hard -to merge them: for example Input Iterator requires Equality Comparable -while Output Iterator does not. - - -

-
- - - -
Figure 1: -The iterator concepts and refinement relationships. -
-
-

- - -

Relationship with the standard iterator concepts

- -

-std::Input Iterator implies boost::ReadableIterator. - -

-std::Output Iterator implies boost::Writable Iterator. - -

-std::Forward Iterator refines boost::Forward Iterator and -boost::Constant Lvalue Iterator or boost::Mutable Lvalue Iterator. - -

-std::Bidirectional Iterator refines boost::Bidirectional Iterator and -boost::Constant Lvalue Iterator or boost::Mutable Lvalue Iterator. - -

-std::Random Access Iterator refines boost::Random Access Iterator and -boost::Constant Lvalue Iterator or boost::Mutable Lvalue Iterator. - - -

Notation

- - - - - - - - - - - - - - - - - -
XThe iterator type.
TThe value type of X, i.e., std::iterator_traits<X>::value_type.
x, yAn object of type X.
tAn object of type T.
- -

- -


- - -

-Readable Iterator -

- -A Readable Iterator is an iterator that dereferences to produce an -rvalue that is convertible to the value_type of the -iterator. - -

Associated Types

- - - - - - - - - - - - - - - - - - - - - -
Value typestd::iterator_traits<X>::value_typeThe type of the objects pointed to by the iterator.
Reference typestd::iterator_traits<X>::reference - The return type of dereferencing the iterator. This - type must be convertible to T. -
Return Categorystd::return_category<X>::type - A type convertible to std::readable_iterator_tag -
- -

Refinement of

- -Copy Constructible - -

Valid expressions

- - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Dereference*x std::iterator_traits<X>::reference
Member accessx->mT is a type with a member named m. -If m is a data member, the type of m. -If m is a member function, the return type of m. -
- -

- -


- - -

-Writable Iterator -

- -A Writable Iterator is an iterator that can be used to store a value -using the dereference-assignment expression. - -

Definitions

- -If x is an Writable Iterator of type X, then the -expression *x = a; stores the value a into -x. Note that operator=, like other C++ functions, -may be overloaded; it may, in fact, even be a template function. In -general, then, a may be any of several different types. A -type A belongs to the set of value types of X -if, for an object a of type A, *x = a; is -well-defined and does not require performing any non-trivial -conversions on a. - -

Associated Types

- - - - - - - - - -
Return Categorystd::return_category<X>::type - A type convertible to std::writable_iterator_tag -
- - - -

Refinement of

- -Copy Constructible - -

Valid expressions

- - - - - - - - - - -
NameExpressionReturn type
Dereference assignment*x = aunspecified
- -

- - -


- - -

-Swappable Iterator -

- -A Swappable Iterator is an iterator whose dereferenced values can be -swapped. - -

-Note: the requirements for Swappable Iterator are dependent on the -issues surrounding std::swap() being resolved. Here we assume -that the issue will be resolved by allowing the overload of -std::swap() for user-defined types. - -

-Note: Readable Iterator and Writable Iterator combined implies -Swappable Iterator because of the fully templated -std::swap(). However, Swappable Iterator does not imply -Readable Iterator nor Writable Iterator. - -

Associated Types

- - - - - - - - - -
Return Categorystd::return_category<X>::type - A type convertible to std::swappable_iterator_tag -
- - -

Valid expressions

- -Of the two valid expressions listed below, only one OR the -other is required. If std::iter_swap() is overloaded for -X then std::swap() is not required. If -std::iter_swap() is not overloaded for X then the -default (fully templated) version is used, which will call -std::swap() (this means changing the current requirements for -std::iter_swap()). - -

- - - - - - - - - - - - - - - - - -
NameExpressionReturn type
Iterator Swapstd::iter_swap(x, y)void
Dereference and Swapstd::swap(*x, *y)void
- -

- - -


- - -

-Constant Lvalue Iterator -

- -A Constant Lvalue Iterator is an iterator that dereferences to produce a -const reference to the pointed-to object, i.e., the associated -reference type is const T&. Changing the value -of or destroying an iterator that models Constant Lvalue Iterator does -not invalidate pointers and references previously obtained from that -iterator. - - -

Refinement of

- -Readable Iterator - -

Associated Types

- - - - - - - - - - - - - - - - - -
Reference typestd::iterator_traits<X>::reference - The return type of dereferencing the iterator, which must be - const T&. -
Return Categorystd::return_category<X>::type - A type convertible to std::constant_lvalue_iterator_tag -
- - - -

- -


- - -

-Mutable Lvalue Iterator -

- -A Mutable Lvalue Iterator is an iterator that dereferences to produce a -reference to the pointed-to object. The associated reference -type is T&. Changing the value of or destroying an -iterator that models Mutable Lvalue Iterator does not invalidate -pointers and references previously obtained from that iterator. - -

Refinement of

- -Readable Iterator, -Writable Iterator, -and Swappable Iterator. - - - -

Associated Types

- - - - - - - - - - - - - - - - - -
Reference typestd::iterator_traits<X>::referenceThe return type of dereferencing the iterator, which must be - T&.
Return Categorystd::return_category<X>::type - A type convertible to std::mutable_lvalue_iterator_tag -
- - - -

-


- - -

-Forward Traversal Iterator -

- -The Forward Iterator is an iterator that can be incremented. Also, it -is permissible to make multiple passes through the iterator's range. - -

Refinement of

- -Copy Constructible, -Assignable, -Default Constructible, and -Equality Comparable - - -

Associated types

- - - - - - - - - - - - - - -
Difference Typestd::iterator_traits<X>::difference_type - A signed integral type used for representing distances - between iterators that point into the same range. -
Traversal Categorystd::traversal_category<X>::type - A type convertible to std::forward_traversal_tag -
- -

Valid expressions

- - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Preincrement++i X&
Postincrementi++ convertible to const X&
- -

-


- - -

-Bidirectional Traversal Iterator -

- -An iterator that can be incremented and decremented. - -

Refinement of

- -Forward Traversal Iterator - -

Associated types

- - - - - - - -
Traversal Categorystd::traversal_category<X>::type - A type convertible to std::bidirectional_traversal_tag -
- -

Valid expressions

- - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Predecrement--i X&
Postdecrementi-- convertible to const X&
- -

-


- - -

-Random Access Traversal Iterator -

- -An iterator that provides constant-time methods for moving forward and -backward in arbitrary-sized steps. - -

Refinement of

- -Bidirectional Traversal Iterator and -Less Than Comparable where < is a total ordering - -

Associated types

- - - - - - - -
Traversal Categorystd::traversal_category<X>::type - A type convertible to std::random_access_traversal_tag -
- -

Valid expressions

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameExpressionType requirementsReturn type
Iterator additioni += n X&
Iterator additioni + n or n + i X
Iterator subtractioni -= n X&
Iterator subtractioni - n X
Differencei - j std::iterator_traits<X>::difference_type
Element operatori[n]X must also be a model of - Readable Iterator. std::iterator_traits<X>::reference
Element assignmenti[n] = tX must also be a model of - Writable Iterator.unspecified
- -

- -


- - -
Copyright © 2000 -Jeremy Siek, Univ.of Notre Dame (jsiek@lsc.nd.edu) -
- - - diff --git a/doc/index.html b/doc/index.html index 58d3e53..9589c14 100755 --- a/doc/index.html +++ b/doc/index.html @@ -53,21 +53,21 @@ older Boost Iterator Adaptor Library.
-

New-Style Iterators

+

New-Style Iterators

The iterator categories defined in C++98 are extremely limiting because they bind together two orthogonal concepts: traversal and element access. For example, because a random access iterator is @@ -86,7 +86,7 @@ concepts, see our

Standard Proposal For New-Style Iterators (PDF)
-

Iterator Facade and Adaptor

+

Iterator Facade and Adaptor

Writing standard-conforming iterators is tricky, but the need comes up often. In order to ease the implementation of new iterators, the Boost.Iterator library provides the iterator_facade class template, @@ -113,7 +113,7 @@ and accepted into the first C++ technical report; see our

for more details.

-

Specialized Adaptors

+

Specialized Adaptors

The iterator library supplies a useful suite of standard-conforming iterator templates based on the Boost iterator facade and adaptor.

    @@ -121,9 +121,6 @@ iterator templates based on the Boost filter_iterator (PDF): an iterator over the subset of elements of some sequence which satisfy a given predicate -
  • function_output_iterator (PDF): an output iterator wrapping a unary function -object; each time an element is written into the dereferenced -iterator, it is passed as a parameter to the function object.
  • indirect_iterator (PDF): an iterator over the objects pointed-to by the elements of some sequence.
  • permutation_iterator (PDF): an iterator over the elements of some random-access @@ -131,8 +128,6 @@ sequence, rearranged according to some sequence of integer indices.
  • reverse_iterator (PDF): an iterator which traverses the elements of some bidirectional sequence in reverse. Corrects many of the shortcomings of C++98's std::reverse_iterator.
  • -
  • shared_container_iterator: an iterator over elements of a container whose -lifetime is maintained by a shared_ptr stored in the iterator.
  • transform_iterator (PDF): an iterator over elements which are the result of applying some functional transformation to the elements of an underlying sequence. This component also replaces the old @@ -142,9 +137,9 @@ positions of heterogeneous underlying iterators.
-

Iterator Utilities

+

Iterator Utilities

-

Traits

+

Traits

  • pointee.hpp (PDF): Provides the capability to deduce the referent types of pointers, smart pointers and iterators in generic code. Used @@ -158,7 +153,7 @@ testing iterator interoperability -->
-

Testing and Concept Checking

+

Testing and Concept Checking

-

Upgrading from the old Boost Iterator Adaptor Library

+

Upgrading from the old Boost Iterator Adaptor Library

If you have been using the old Boost Iterator Adaptor library to implement iterators, you probably wrote a Policies class which captures the core operations of your iterator. In the new library @@ -176,7 +171,7 @@ you probably wrote a iterator_adaptor specialization you needed; in the new library design you don't need a type generator (though may want to keep it around as a compatibility aid for older code) because, due to the -use of the Curiously Recurring Template Pattern (CRTP) [Cop95], +use of the Curiously Recurring Template Pattern (CRTP) [Cop95], you can now define the iterator class yourself and acquire functionality through inheritance from iterator_facade or iterator_adaptor. As a result, you also get much finer control @@ -191,7 +186,7 @@ type, transform_iterator will projection_iterator used to.

-

History

+

History

In 2000 Dave Abrahams was writing an iterator for a container of pointers, which would access the pointed-to elements when dereferenced. Naturally, being a library writer, he decided to @@ -220,7 +215,7 @@ library you see today.

-[Cop95][Coplien, 1995] Coplien, J., Curiously Recurring Template +[Cop95][Coplien, 1995] Coplien, J., Curiously Recurring Template Patterns, C++ Report, February 1995, pp. 24-27. diff --git a/doc/index.pdf b/doc/index.pdf new file mode 100755 index 0000000..aed0bdc Binary files /dev/null and b/doc/index.pdf differ diff --git a/doc/index.rst b/doc/index.rst index 0d688c2..2b1cdf5 100755 --- a/doc/index.rst +++ b/doc/index.rst @@ -134,10 +134,6 @@ iterator templates based on the Boost `iterator facade and adaptor`_. * |filter|_ (PDF__): an iterator over the subset of elements of some sequence which satisfy a given predicate -* |function|_ (PDF__): an output iterator wrapping a unary function - object; each time an element is written into the dereferenced - iterator, it is passed as a parameter to the function object. - * |indirect|_ (PDF__): an iterator over the objects *pointed-to* by the elements of some sequence. @@ -148,9 +144,6 @@ iterator templates based on the Boost `iterator facade and adaptor`_. bidirectional sequence in reverse. Corrects many of the shortcomings of C++98's ``std::reverse_iterator``. -* |shared|_: an iterator over elements of a container whose - lifetime is maintained by a |shared_ptr|_ stored in the iterator. - * |transform|_ (PDF__): an iterator over elements which are the result of applying some functional transformation to the elements of an underlying sequence. This component also replaces the old @@ -167,10 +160,6 @@ __ counting_iterator.pdf .. _filter: filter_iterator.html __ filter_iterator.pdf -.. |function| replace:: ``function_output_iterator`` -.. _function: function_output_iterator.html -__ function_output_iterator.pdf - .. |indirect| replace:: ``indirect_iterator`` .. _indirect: indirect_iterator.html __ indirect_iterator.pdf @@ -183,9 +172,6 @@ __ permutation_iterator.pdf .. _reverse: reverse_iterator.html __ reverse_iterator.pdf -.. |shared| replace:: ``shared_container_iterator`` -.. _shared: ../../utility/shared_container_iterator.html - .. |transform| replace:: ``transform_iterator`` .. _transform: transform_iterator.html __ transform_iterator.pdf @@ -194,9 +180,6 @@ __ transform_iterator.pdf .. _zip: zip_iterator.html __ zip_iterator.pdf -.. |shared_ptr| replace:: ``shared_ptr`` -.. _shared_ptr: ../../smart_ptr/shared_ptr.htm - ==================== Iterator Utilities ==================== diff --git a/doc/iterator_traits.pdf b/doc/iterator_traits.pdf index dd21246..d2ce590 100755 Binary files a/doc/iterator_traits.pdf and b/doc/iterator_traits.pdf differ diff --git a/doc/pointee.html b/doc/pointee.html index 63d2261..0678b9f 100755 --- a/doc/pointee.html +++ b/doc/pointee.html @@ -7,7 +7,7 @@ pointee and indirect_reference - + @@ -25,7 +25,7 @@ Organization: Boost Consulting Date: -2004-01-29 +2004-01-13 Copyright: Copyright David Abrahams 2004. All rights reserved diff --git a/doc/pointee.pdf b/doc/pointee.pdf index ad59911..83e5f84 100755 Binary files a/doc/pointee.pdf and b/doc/pointee.pdf differ diff --git a/doc/style.tex b/doc/style.tex new file mode 100755 index 0000000..681d6b3 --- /dev/null +++ b/doc/style.tex @@ -0,0 +1,41 @@ +% donot indent first line. +\setlength{\parindent}{0pt} +\setlength{\parskip}{5pt plus 2pt minus 1pt} + +% sloppy +% ------ +% Less strict (opposite to default fussy) space size between words. Therefore +% less hyphenation. +\sloppy + +% fonts +% ----- +% times for pdf generation, gives smaller pdf files. +% +% But in standard postscript fonts: courier and times/helvetica do not fit. +% Maybe use pslatex. +\usepackage{times} +\usepackage{pslatex} + +% pagestyle +% \usepackage{fancyhdr} +\pagestyle{headings} +\setlength{\paperwidth}{8.5in} +\setlength{\paperheight}{11in} + +\setlength{\oddsidemargin}{0.375in} +\setlength{\evensidemargin}{0.375in} +\setlength{\textwidth}{6.125in} +\setlength{\textheight}{8.875in} + +\setlength{\topmargin}{-0.375in} +\setlength{\headheight}{0.25in} +\setlength{\headsep}{0.25in} +\setlength{\footskip}{0.25in} + +\setlength{\admonitionwidth}{0.9\textwidth} +\setlength{\docinfowidth}{0.9\textwidth} + + + + diff --git a/doc/zip_iterator.pdf b/doc/zip_iterator.pdf index 6b4c0f1..8cbd22d 100755 Binary files a/doc/zip_iterator.pdf and b/doc/zip_iterator.pdf differ diff --git a/example/Jamfile b/example/Jamfile index cb49f1a..6eb6cc7 100644 --- a/example/Jamfile +++ b/example/Jamfile @@ -10,11 +10,4 @@ test-suite iterator_examples [ run node_iterator1.cpp ] [ run node_iterator2.cpp ] [ run node_iterator3.cpp ] - [ run counting_iterator_example.cpp ] - [ run filter_iterator_example.cpp ] - [ run function_output_iterator_example.cpp ] - [ run indirect_iterator_example.cpp ] - [ run permutation_iterator_example.cpp ] - [ run reverse_iterator_example.cpp ] - [ run transform_iterator_example.cpp ] ; diff --git a/include/boost/function_output_iterator.hpp b/include/boost/function_output_iterator.hpp index 0e22e03..764c118 100644 --- a/include/boost/function_output_iterator.hpp +++ b/include/boost/function_output_iterator.hpp @@ -26,9 +26,7 @@ namespace boost { typedef void pointer; typedef void reference; - explicit function_output_iterator() {} - - explicit function_output_iterator(const UnaryFunction& f) + explicit function_output_iterator(const UnaryFunction& f = UnaryFunction()) : m_f(f) {} struct output_proxy { diff --git a/include/boost/iterator/detail/facade_iterator_category.hpp b/include/boost/iterator/detail/facade_iterator_category.hpp index 5bee4b8..dd7de98 100755 --- a/include/boost/iterator/detail/facade_iterator_category.hpp +++ b/include/boost/iterator/detail/facade_iterator_category.hpp @@ -107,8 +107,13 @@ struct iterator_facade_default_category // check for readability , is_convertible > - , mpl::identity - , mpl::identity + , mpl::if_< + iterator_writability_disabled + , std::input_iterator_tag + , input_output_iterator_tag + > + + , mpl::identity > > { diff --git a/include/boost/iterator/iterator_categories.hpp b/include/boost/iterator/iterator_categories.hpp index 6153c6f..7b4f9ae 100644 --- a/include/boost/iterator/iterator_categories.hpp +++ b/include/boost/iterator/iterator_categories.hpp @@ -27,11 +27,7 @@ namespace boost { // // Traversal Categories // - -struct no_traversal_tag {}; - -struct incrementable_traversal_tag - : no_traversal_tag {}; +struct incrementable_traversal_tag {}; struct single_pass_traversal_tag : incrementable_traversal_tag {}; diff --git a/include/boost/iterator/iterator_concepts.hpp b/include/boost/iterator/iterator_concepts.hpp index f060491..93e0972 100644 --- a/include/boost/iterator/iterator_concepts.hpp +++ b/include/boost/iterator/iterator_concepts.hpp @@ -60,13 +60,19 @@ namespace boost_concepts { class ReadableIteratorConcept { public: typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::value_type value_type; + typedef BOOST_DEDUCED_TYPENAME boost::detail::iterator_traits::reference reference; void constraints() { - boost::function_requires< boost::AssignableConcept >(); - boost::function_requires< boost::CopyConstructibleConcept >(); + boost::function_requires< boost::SGIAssignableConcept >(); + boost::function_requires< boost::EqualityComparableConcept >(); + boost::function_requires< + boost::DefaultConstructibleConcept >(); - value_type v = *i; + reference r = *i; // or perhaps read(x) + value_type v = r; + value_type v2 = *i; boost::ignore_unused_variable_warning(v); + boost::ignore_unused_variable_warning(v2); } Iterator i; }; @@ -79,8 +85,12 @@ namespace boost_concepts { public: void constraints() { - boost::function_requires< boost::CopyConstructibleConcept >(); - *i = v; + boost::function_requires< boost::SGIAssignableConcept >(); + boost::function_requires< boost::EqualityComparableConcept >(); + boost::function_requires< + boost::DefaultConstructibleConcept >(); + + *i = v; // a good alternative could be something like write(x, v) } ValueType v; Iterator i; @@ -98,18 +108,47 @@ namespace boost_concepts { }; template - class LvalueIteratorConcept + class ReadableLvalueIteratorConcept { public: typedef typename boost::detail::iterator_traits::value_type value_type; + typedef typename boost::detail::iterator_traits::reference reference; + void constraints() { - value_type& r = const_cast(*i); - boost::ignore_unused_variable_warning(r); - } + boost::function_requires< ReadableIteratorConcept >(); + + typedef boost::mpl::or_< + boost::is_same + , boost::is_same + > correct_reference; + + BOOST_STATIC_ASSERT(correct_reference::value); + + reference v = *i; + boost::ignore_unused_variable_warning(v); + } Iterator i; }; + template + class WritableLvalueIteratorConcept { + public: + typedef typename boost::detail::iterator_traits::value_type value_type; + typedef typename boost::detail::iterator_traits::reference reference; + + void constraints() { + boost::function_requires< + ReadableLvalueIteratorConcept >(); + boost::function_requires< + WritableIteratorConcept >(); + boost::function_requires< + SwappableIteratorConcept >(); + + + BOOST_STATIC_ASSERT((boost::is_same::value)); + } + }; //=========================================================================== // Iterator Traversal Concepts @@ -120,8 +159,9 @@ namespace boost_concepts { typedef typename boost::iterator_traversal::type traversal_category; void constraints() { - boost::function_requires< boost::AssignableConcept >(); - boost::function_requires< boost::CopyConstructibleConcept >(); + boost::function_requires< boost::SGIAssignableConcept >(); + boost::function_requires< + boost::DefaultConstructibleConcept >(); BOOST_STATIC_ASSERT( (boost::is_convertible< @@ -163,8 +203,6 @@ namespace boost_concepts { void constraints() { boost::function_requires< SinglePassIteratorConcept >(); - boost::function_requires< - boost::DefaultConstructibleConcept >(); typedef boost::mpl::and_< boost::is_integral, @@ -233,74 +271,125 @@ namespace boost_concepts { //=========================================================================== // Iterator Interoperability Concept - namespace detail - { +namespace detail +{ - template - void interop_single_pass_constraints(Iterator1 const& i1, Iterator2 const& i2) - { - bool b; - b = i1 == i2; - b = i1 != i2; - - b = i2 == i1; - b = i2 != i1; - } + template + struct Operations; - template - void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2, - boost::random_access_traversal_tag, boost::random_access_traversal_tag) + template <> + struct Operations + { + template + static void constraints(Iterator1 const& i1, Iterator2 const& i2) + { + // no interoperability constraints + } + }; + + template <> + struct Operations + { + template + static void constraints(Iterator1 const& i1, Iterator2 const& i2) + { + Operations::constraints(i1, i2); + i1 == i2; + i1 != i2; + + i2 == i1; + i2 != i1; + } + }; + + template <> + struct Operations + { + template + static void constraints(Iterator1 const& i1, Iterator2 const& i2) + { + Operations::constraints(i1, i2); + } + }; + + template <> + struct Operations + { + template + static void constraints(Iterator1 const& i1, Iterator2 const& i2) + { + Operations::constraints(i1, i2); + } + }; + + template <> + struct Operations { - bool b; - typename boost::detail::iterator_traits::difference_type n; - b = i1 < i2; - b = i1 <= i2; - b = i1 > i2; - b = i1 >= i2; - n = i1 - i2; - - b = i2 < i1; - b = i2 <= i1; - b = i2 > i1; - b = i2 >= i1; - n = i2 - i1; - } - template - void interop_rand_access_constraints(Iterator1 const& i1, Iterator2 const& i2, - boost::single_pass_traversal_tag, boost::single_pass_traversal_tag) - { } + template + static void constraints(Iterator1 const& i1, Iterator2 const& i2) + { + Operations::constraints(i1, i2); + + i1 < i2; + i1 <= i2; + i1 > i2; + i1 >= i2; + i1 - i2; + + i2 < i1; + i2 <= i1; + i2 > i1; + i2 >= i1; + i2 - i1; + } + }; } // namespace detail - template - class InteroperableIteratorConcept - { - public: - typedef typename boost::detail::pure_traversal_tag< - typename boost::iterator_traversal< - Iterator - >::type - >::type traversal_category; + template + class InteroperableConcept + { + public: + typedef typename boost::detail::pure_traversal_tag< + typename boost::iterator_traversal< + Iterator + >::type + >::type traversal_category; + + typedef typename + boost::detail::iterator_traits::difference_type + difference_type; - typedef typename boost::detail::pure_traversal_tag< - typename boost::iterator_traversal< - ConstIterator - >::type - >::type const_traversal_category; + typedef typename boost::detail::pure_traversal_tag< + typename boost::iterator_traversal< + ConstIterator + >::type + >::type const_traversal_category; + + typedef typename + boost::detail::iterator_traits::difference_type + const_difference_type; - void constraints() - { - boost::function_requires< SinglePassIteratorConcept >(); - boost::function_requires< SinglePassIteratorConcept >(); + void constraints() + { + BOOST_STATIC_ASSERT( + (boost::is_same< difference_type, const_difference_type>::value) + ); + + BOOST_STATIC_ASSERT( + (boost::is_same< traversal_category, const_traversal_category>::value) + ); - detail::interop_single_pass_constraints(i, ci); - detail::interop_rand_access_constraints(i, ci, traversal_category(), const_traversal_category()); + // ToDo check what the std really requires - ci = i; - } - Iterator i; - ConstIterator ci; - }; + // detail::Operations::constraints(i, ci); + + ci = i; + + } + Iterator i; + ConstIterator ci; + }; } // namespace boost_concepts diff --git a/include/boost/iterator/permutation_iterator.hpp b/include/boost/iterator/permutation_iterator.hpp index bb601c8..f41da1a 100644 --- a/include/boost/iterator/permutation_iterator.hpp +++ b/include/boost/iterator/permutation_iterator.hpp @@ -18,40 +18,64 @@ namespace boost { template< class ElementIterator - , class IndexIterator> + , class IndexIterator + , class ValueT = use_default + , class CategoryT = use_default + , class ReferenceT = use_default + , class DifferenceT = use_default > class permutation_iterator : public iterator_adaptor< - permutation_iterator - , IndexIterator, typename detail::iterator_traits::value_type - , use_default, typename detail::iterator_traits::reference> + permutation_iterator + , ElementIterator, ValueT, CategoryT, ReferenceT, DifferenceT > { typedef iterator_adaptor< - permutation_iterator - , IndexIterator, typename detail::iterator_traits::value_type - , use_default, typename detail::iterator_traits::reference> super_t; + permutation_iterator + , ElementIterator, ValueT, CategoryT, ReferenceT, DifferenceT > super_t; friend class iterator_core_access; public: - permutation_iterator() : m_elt_iter() {} + permutation_iterator() : order_it_() {} explicit permutation_iterator(ElementIterator x, IndexIterator y) - : super_t(y), m_elt_iter(x) {} + : super_t(x), order_it_(y) {} - template + template permutation_iterator( - permutation_iterator const& r + permutation_iterator const& r , typename enable_if_convertible::type* = 0 , typename enable_if_convertible::type* = 0 ) - : super_t(r.base()), m_elt_iter(r.m_elt_iter) + : super_t(r.base()) {} private: typename super_t::reference dereference() const - { return *(m_elt_iter + *this->base()); } + { return *(this->base() + *this->order_it_); } + + void increment() { ++this->order_it_; } + void decrement() { --this->order_it_; } - ElementIterator m_elt_iter; + void advance(typename super_t::difference_type n) + { + std::advance( order_it_, n ); + } + + template + typename super_t::difference_type + distance_to( permutation_iterator const& y ) const + { + return std::distance( this->order_it_, y.order_it_ ); + } + + template + bool + equal( permutation_iterator const& y ) const + { + return( y.order_it_ == this->order_it_ ); + } + + IndexIterator order_it_; }; diff --git a/test/Jamfile b/test/Jamfile index 020e098..32f34e5 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -36,8 +36,6 @@ test-suite iterator [ run iterator_adaptor_cc.cpp ] [ run iterator_adaptor_test.cpp ] [ compile iterator_archetype_cc.cpp ] - [ compile-fail iterator_archetype_default_ctor.cpp ] - [ compile-fail lvalue_concept_fail_expected.cpp ] [ run transform_iterator_test.cpp ] [ run indirect_iterator_test.cpp ] [ compile indirect_iterator_member_types.cpp ] diff --git a/test/concept_tests.cpp b/test/concept_tests.cpp index dd99600..399911d 100644 --- a/test/concept_tests.cpp +++ b/test/concept_tests.cpp @@ -61,35 +61,23 @@ main() (void)derived; boost::function_requires< - boost_concepts::WritableIteratorConcept >(); - boost::function_requires< - boost_concepts::LvalueIteratorConcept >(); + boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); boost::function_requires< - boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< - boost_concepts::LvalueIteratorConcept >(); + boost_concepts::ReadableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); boost::function_requires< - boost_concepts::WritableIteratorConcept >(); - boost::function_requires< - boost_concepts::LvalueIteratorConcept >(); + boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); boost::function_requires< - boost_concepts::WritableIteratorConcept >(); - boost::function_requires< - boost_concepts::LvalueIteratorConcept >(); + boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - - boost::function_requires< - boost_concepts::InteroperableIteratorConcept >(); - return 0; } diff --git a/test/filter_iterator_test.cpp b/test/filter_iterator_test.cpp index 11c260c..8b4d190 100644 --- a/test/filter_iterator_test.cpp +++ b/test/filter_iterator_test.cpp @@ -125,8 +125,7 @@ int main() > BaseIter; typedef boost::filter_iterator Iter; boost::function_requires< boost::ForwardIteratorConcept >(); - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::ForwardTraversalConcept >(); } { @@ -137,8 +136,7 @@ int main() > BaseIter; typedef boost::filter_iterator Iter; boost::function_requires< boost::Mutable_ForwardIteratorConcept >(); - boost::function_requires< boost_concepts::WritableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::ForwardTraversalConcept >(); } #endif diff --git a/test/indirect_iterator_test.cpp b/test/indirect_iterator_test.cpp index 781c226..56db69b 100644 --- a/test/indirect_iterator_test.cpp +++ b/test/indirect_iterator_test.cpp @@ -175,7 +175,7 @@ main() > c_iter_t; # ifndef NO_MUTABLE_CONST_RA_ITERATOR_INTEROPERABILITY - boost::function_requires< boost_concepts::InteroperableIteratorConcept >(); + boost::function_requires< boost_concepts::InteroperableConcept >(); # endif } diff --git a/test/iterator_adaptor_cc.cpp b/test/iterator_adaptor_cc.cpp index 67683f0..ba7e79b 100644 --- a/test/iterator_adaptor_cc.cpp +++ b/test/iterator_adaptor_cc.cpp @@ -10,32 +10,20 @@ int main() typedef boost::reverse_iterator rev_iter; typedef boost::reverse_iterator c_rev_iter; - boost::function_requires< boost_concepts::WritableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); boost::function_requires< boost::RandomAccessIteratorConcept >(); - boost::function_requires< boost_concepts::InteroperableIteratorConcept >(); + boost::function_requires< boost_concepts::InteroperableConcept >(); } - - // Many compilers' builtin container iterators don't interoperate well, though - // STLport fixes that problem. -#if defined(__SGI_STL_PORT) \ - || !BOOST_WORKAROUND(__GNUC__, <= 2) \ - && !(BOOST_WORKAROUND(__GNUC__, == 3) && BOOST_WORKAROUND(__GNUC_MINOR__, <= 1)) \ - && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) \ - && !BOOST_WORKAROUND(__LIBCOMO_VERSION__, BOOST_TESTED_AT(29)) \ - && !BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, <= 1) { typedef boost::reverse_iterator::iterator> rev_iter; typedef boost::reverse_iterator::const_iterator> c_rev_iter; - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); boost::function_requires< boost::BidirectionalIteratorConcept >(); - boost::function_requires< boost_concepts::InteroperableIteratorConcept >(); + boost::function_requires< boost_concepts::InteroperableConcept >(); } -#endif - + return boost::exit_success; } diff --git a/test/iterator_adaptor_test.cpp b/test/iterator_adaptor_test.cpp index ca39a87..961895f 100644 --- a/test/iterator_adaptor_test.cpp +++ b/test/iterator_adaptor_test.cpp @@ -150,18 +150,18 @@ template struct in_iterator : boost::iterator_adaptor< in_iterator - , boost::input_iterator_archetype_no_proxy + , boost::input_iterator_archetype > { private: typedef boost::iterator_adaptor< in_iterator - , boost::input_iterator_archetype_no_proxy + , boost::input_iterator_archetype > super_t; public: in_iterator() { } - in_iterator(boost::input_iterator_archetype_no_proxy d) : super_t(d) { } + in_iterator(boost::input_iterator_archetype d) : super_t(d) { } }; template @@ -309,7 +309,7 @@ main() // check operator-> with an input iterator { - boost::input_iterator_archetype_no_proxy input_iter; + boost::input_iterator_archetype input_iter; typedef in_iterator adaptor_type; adaptor_type i(input_iter); int zero = 0; diff --git a/test/iterator_archetype_cc.cpp b/test/iterator_archetype_cc.cpp index 6a71551..b5badea 100644 --- a/test/iterator_archetype_cc.cpp +++ b/test/iterator_archetype_cc.cpp @@ -9,54 +9,18 @@ #include #include #include -#include int main() { - { - typedef boost::iterator_archetype< - int - , boost::iterator_archetypes::readable_iterator_t - , boost::random_access_traversal_tag - > iter; - - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } - { - typedef boost::iterator_archetype< - int - , boost::iterator_archetypes::readable_writable_iterator_t - , boost::random_access_traversal_tag - > iter; - - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::WritableIteratorConcept >(); - boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } - { - typedef boost::iterator_archetype< - const int // I don't like adding const to Value. It is redundant. -JGS - , boost::iterator_archetypes::readable_lvalue_iterator_t - , boost::random_access_traversal_tag - > iter; - - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); - boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } - { typedef boost::iterator_archetype< int , boost::iterator_archetypes::writable_lvalue_iterator_t , boost::random_access_traversal_tag > iter; - boost::function_requires< boost_concepts::WritableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::RandomAccessTraversalConcept >(); - } - - return boost::exit_success; + + return 0; // keep msvc happy } diff --git a/test/iterator_archetype_default_ctor.cpp b/test/iterator_archetype_default_ctor.cpp deleted file mode 100755 index fd10b35..0000000 --- a/test/iterator_archetype_default_ctor.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -// Copyright Thomas Witt 2004. 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 - - -int main() -{ - typedef boost::iterator_archetype< - int - , boost::iterator_archetypes::readable_iterator_t - , boost::single_pass_traversal_tag - > iter; - - // single_pass_traversal iterators are not required to be - // default constructible - iter it; -} diff --git a/test/lvalue_concept_fail_expected.cpp b/test/lvalue_concept_fail_expected.cpp deleted file mode 100644 index b52c52d..0000000 --- a/test/lvalue_concept_fail_expected.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -int main() -{ - typedef boost::iterator_archetype< - int - , boost::iterator_archetypes::readable_iterator_t - , boost::single_pass_traversal_tag - > Iter; - boost::function_requires< - boost_concepts::LvalueIteratorConcept >(); - return boost::exit_success; -} diff --git a/test/permutation_iterator_test.cpp b/test/permutation_iterator_test.cpp index ad23300..f409698 100644 --- a/test/permutation_iterator_test.cpp +++ b/test/permutation_iterator_test.cpp @@ -20,7 +20,7 @@ void permutation_test() { // Example taken from documentation of old permutation_iterator. - typedef std::vector< double > element_range_type; + typedef std::vector< int > element_range_type; typedef std::list< int > index_type; const int element_range_size = 10; @@ -52,22 +52,21 @@ void permutation_test() } it = begin; - for( int i1 = 0; i1 < index_size - 1 ; ++++i1, ++++it ) + for( int i1 = 0; i1 < index_size - 1 ; i1+=2, it+=2 ) { index_type::iterator i_it2 = indices.begin(); std::advance( i_it2, i1 ); BOOST_CHECK( *it == elements[ *i_it2 ] ); } - it = begin; - std::advance(it, index_size); + + it = begin + (index_size); for( index_type::iterator i_it3 = indices.end(); it != begin; ) { BOOST_CHECK( *--it == elements[ *--i_it3 ] ); } - it = begin; - std::advance(it, index_size); + it = begin + index_size; for( int i2 = 0; i2 < index_size - 1; i2+=2, --it ) { index_type::iterator i_it4 = --indices.end(); diff --git a/test/reverse_iterator_test.cpp b/test/reverse_iterator_test.cpp index 6686d30..5c3d50e 100644 --- a/test/reverse_iterator_test.cpp +++ b/test/reverse_iterator_test.cpp @@ -31,15 +31,13 @@ int main() { typedef boost::reverse_iterator > Iter; boost::function_requires< boost::BidirectionalIteratorConcept >(); - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } { typedef boost::reverse_iterator > Iter; boost::function_requires< boost::Mutable_BidirectionalIteratorConcept >(); - boost::function_requires< boost_concepts::WritableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } // Adapting new-style iterators @@ -89,8 +87,7 @@ int main() > iter; typedef boost::reverse_iterator Iter; boost::function_requires< boost::BidirectionalIteratorConcept >(); - boost::function_requires< boost_concepts::ReadableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::ReadableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } { @@ -101,8 +98,7 @@ int main() > iter; typedef boost::reverse_iterator Iter; boost::function_requires< boost::BidirectionalIteratorConcept >(); - boost::function_requires< boost_concepts::WritableIteratorConcept >(); - boost::function_requires< boost_concepts::LvalueIteratorConcept >(); + boost::function_requires< boost_concepts::WritableLvalueIteratorConcept >(); boost::function_requires< boost_concepts::BidirectionalTraversalConcept >(); } #endif diff --git a/test/transform_iterator_test.cpp b/test/transform_iterator_test.cpp index 6c02a26..2c9139a 100644 --- a/test/transform_iterator_test.cpp +++ b/test/transform_iterator_test.cpp @@ -115,7 +115,7 @@ main() typedef boost::transform_iterator iter_t; typedef boost::transform_iterator c_iter_t; - boost::function_requires< boost_concepts::InteroperableIteratorConcept >(); + boost::function_requires< boost_concepts::InteroperableConcept >(); } // Test transform_iterator