Compare commits

..

2 Commits

Author SHA1 Message Date
nobody
3a85f00159 This commit was manufactured by cvs2svn to create tag
'Version_1_27_0'.

[SVN r12749]
2002-02-07 13:33:59 +00:00
nobody
b516fa1257 This commit was manufactured by cvs2svn to create branch 'RC_1_27_0'.
[SVN r12739]
2002-02-06 03:32:50 +00:00
6 changed files with 50 additions and 155 deletions

View File

@@ -4,7 +4,7 @@
// without express or implied warranty, and with no claim as to its suitability
// for any purpose.
//
// See http://www.boost.org/libs/utility/counting_iterator.htm for documentation.
// See http://www.boost.org for most recent version including documentation.
//
// Supplies:
//
@@ -56,7 +56,9 @@
# include <boost/type_traits.hpp>
# include <boost/detail/numeric_traits.hpp>
# include <boost/static_assert.hpp>
# include <boost/limits.hpp>
# ifndef BOOST_NO_LIMITS
# include <limits>
# endif
namespace boost {
@@ -133,7 +135,7 @@ namespace detail {
// For a while, this wasn't true, but we rely on it below. This is a regression assert.
BOOST_STATIC_ASSERT(::boost::is_integral<char>::value);
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# if defined(BOOST_HAS_LONG_LONG)
# if defined(ULLONG_MAX) || defined(ULONG_LONG_MAX)
BOOST_STATIC_CONSTANT(bool,
value = (
std::numeric_limits<T>::is_specialized

View File

@@ -5,7 +5,7 @@
// 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/libs/utility for documentation.
// See http://www.boost.org for most recent version including documentation.
// Revision History
// 12 Jan 01 added <cstddef> for std::ptrdiff_t (Jens Maurer)

View File

@@ -9,9 +9,7 @@
// 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/libs/utility/iterator_adaptors.htm for documentation.
//
// Revision History:
// 01 Feb 2002 Jeremy Siek
@@ -126,12 +124,14 @@
# include <boost/type.hpp>
# include <boost/static_assert.hpp>
# include <boost/type_traits.hpp>
# include <boost/type_traits/conversion_traits.hpp>
# include <boost/detail/iterator.hpp>
# include <boost/detail/select_type.hpp>
# include <boost/detail/workaround.hpp>
# if BOOST_WORKAROUND(__GNUC__, == 2) && __GNUC_MINOR__ <= 96 && !defined(__STL_USE_NAMESPACES)
// I was having some problems with VC6. I couldn't tell whether our hack for
// stock GCC was causing problems so I needed an easy way to turn it on and
// off. Now we can test the hack with various compilers and still have an
// "out" if it doesn't work. -dwa 7/31/00
# if __GNUC__ == 2 && __GNUC_MINOR__ <= 96 && !defined(__STL_USE_NAMESPACES)
# define BOOST_RELOPS_AMBIGUITY_BUG 1
# endif
@@ -147,7 +147,7 @@ namespace boost {
template <class Policies, class Adapted, class Traits>
struct TrivialIteratorPoliciesConcept
{
typedef typename Traits::reference reference;
typedef typename Traits::reference Reference;
void constraints() {
function_requires< AssignableConcept<Policies> >();
function_requires< DefaultConstructibleConcept<Policies> >();
@@ -157,7 +157,7 @@ struct TrivialIteratorPoliciesConcept
const_constraints();
}
void const_constraints() const {
reference r = p.dereference(x);
Reference r = p.dereference(x);
b = p.equal(x, x);
ignore_unused_variable_warning(r);
}
@@ -382,7 +382,7 @@ namespace detail {
};
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_STD_ITERATOR_TRAITS)
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
// Select default pointer and reference types for adapted non-pointer
// iterators based on the iterator and the value_type. Poor man's partial
@@ -565,7 +565,7 @@ namespace detail {
// An associative list is a list of key-value pairs. The list is
// built out of cons_type's and is terminated by end_of_list.
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || BOOST_WORKAROUND(__BORLANDC__, != 0)
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(__BORLANDC__)
template <class AssocList, class Key>
struct find_param;
@@ -625,10 +625,10 @@ namespace detail {
template <class Value>
struct is_named_parameter
{
enum { value = is_convertible< typename add_reference< Value >::type, add_reference< named_template_param_base >::type >::value };
enum { value = is_convertible<Value, named_template_param_base>::value };
};
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) // workaround for broken is_convertible implementation
# if defined(__MWERKS__) && __MWERKS__ <= 0x2406 // workaround for broken is_convertible implementation
template <class T> struct is_named_parameter<value_type_is<T> > { enum { value = true }; };
template <class T> struct is_named_parameter<reference_is<T> > { enum { value = true }; };
template <class T> struct is_named_parameter<pointer_is<T> > { enum { value = true }; };
@@ -638,7 +638,7 @@ namespace detail {
template <class Key, class Value>
struct make_arg {
# if BOOST_WORKAROUND(__BORLANDC__, > 0)
# ifdef __BORLANDC__
// Borland C++ doesn't like the extra indirection of is_named_parameter
typedef typename
if_true<(is_convertible<Value,named_template_param_base>::value)>::
@@ -761,18 +761,12 @@ namespace detail {
BOOST_STATIC_ASSERT(forward_iter_with_real_reference);
};
template <class T, class Result> struct dependent
{
typedef Result type;
};
} // namespace detail
// This macro definition is only temporary in this file
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# if !defined(BOOST_MSVC)
# define BOOST_ARG_DEPENDENT_TYPENAME typename
# else
# define BOOST_ARG_DEPENDENT_TYPENAME
@@ -861,9 +855,9 @@ struct iterator_adaptor :
policies().initialize(base());
}
#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300) || BOOST_WORKAROUND(__BORLANDC__, > 0)
#if defined(BOOST_MSVC) || defined(__BORLANDC__)
// This is required to prevent a bug in how VC++ generates
// the assignment operator for compressed_pair
// the assignment operator for compressed_pairv
iterator_adaptor& operator= (const iterator_adaptor& x) {
m_iter_p = x.m_iter_p;
return *this;
@@ -873,7 +867,7 @@ struct iterator_adaptor :
return policies().dereference(*this);
}
#if BOOST_WORKAROUND(BOOST_MSVC, > 0)
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning( disable : 4284 )
#endif
@@ -882,16 +876,15 @@ struct iterator_adaptor :
operator->() const
{ return detail::operator_arrow(*this, iterator_category()); }
#if BOOST_WORKAROUND(BOOST_MSVC, > 0)
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
template <class diff_type>
typename detail::dependent<diff_type, value_type>::type operator[](diff_type n) const
value_type operator[](difference_type n) const
{ return *(*this + n); }
self& operator++() {
#if !BOOST_WORKAROUND(__MWERKS__, < 0x2405)
#if !defined(__MWERKS__) || __MWERKS__ >= 0x2405
policies().increment(*this);
#else
// Odd bug, MWERKS couldn't deduce the type for the member template
@@ -904,7 +897,7 @@ struct iterator_adaptor :
self operator++(int) { self tmp(*this); ++*this; return tmp; }
self& operator--() {
#if !BOOST_WORKAROUND(__MWERKS__, < 0x2405)
#if !defined(__MWERKS__) || __MWERKS__ >= 0x2405
policies().decrement(*this);
#else
policies().decrement<self>(*this);
@@ -1104,7 +1097,7 @@ struct indirect_iterator_policies : public default_iterator_policies
};
namespace detail {
# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // strangely instantiated even when unused! Maybe try a recursive template someday ;-)
# if !defined(BOOST_MSVC) // stragely instantiated even when unused! Maybe try a recursive template someday ;-)
template <class T>
struct traits_of_value_type {
typedef typename boost::detail::iterator_traits<T>::value_type outer_value;
@@ -1117,12 +1110,12 @@ namespace detail {
template <class OuterIterator, // Mutable or Immutable, does not matter
class Value
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::value_type
#endif
, class Reference
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::reference
#else
@@ -1131,7 +1124,7 @@ template <class OuterIterator, // Mutable or Immutable, does not matter
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
OuterIterator>::iterator_category
, class Pointer
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::pointer
#else
@@ -1146,28 +1139,28 @@ struct indirect_iterator_generator
template <class OuterIterator, // Mutable or Immutable, does not matter
class Value
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::value_type
#endif
, class Reference
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::reference
#else
= Value &
#endif
, class ConstReference = Value const&
, class ConstReference = const Value&
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
OuterIterator>::iterator_category
, class Pointer
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#if !defined(BOOST_MSVC)
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::pointer
#else
= Value*
#endif
, class ConstPointer = Value const*
, class ConstPointer = const Value*
>
struct indirect_iterator_pair_generator
{
@@ -1177,7 +1170,7 @@ struct indirect_iterator_pair_generator
Value, ConstReference,Category,ConstPointer>::type const_iterator;
};
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
#ifndef BOOST_MSVC
template <class OuterIterator>
inline typename indirect_iterator_generator<OuterIterator>::type
make_indirect_iterator(OuterIterator base)
@@ -1363,7 +1356,7 @@ namespace detail {
template <class Iterator>
struct non_bidirectional_category
{
# if !BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
# if !defined(__MWERKS__) || __MWERKS__ > 0x2406
typedef typename reduce_to_base_class<
std::forward_iterator_tag,
typename iterator_traits<Iterator>::iterator_category
@@ -1399,7 +1392,7 @@ template <class Predicate, class Iterator,
class filter_iterator_generator {
BOOST_STATIC_CONSTANT(bool, is_bidirectional
= (boost::is_convertible<Category*, std::bidirectional_iterator_tag*>::value));
#if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) // I don't have any idea why this occurs, but it doesn't seem to hurt too badly.
#ifndef BOOST_MSVC // I don't have any idea why this occurs, but it doesn't seem to hurt too badly.
BOOST_STATIC_ASSERT(!is_bidirectional);
#endif
typedef filter_iterator_policies<Predicate,Iterator> policies_type;

View File

@@ -5,10 +5,6 @@
// test suite for STL concepts such as iterators and containers.
//
// Revision History:
// 28 Apr 2002 Fixed input iterator requirements.
// For a == b a++ == b++ is no longer required.
// See 24.1.1/3 for details.
// (Thomas Witt)
// 08 Feb 2001 Fixed bidirectional iterator test so that
// --i is no longer a precondition.
// (Jeremy Siek)
@@ -78,40 +74,22 @@ void mutable_trivial_iterator_test(const Iterator i, const Iterator j, T val)
template <class Iterator, class T>
void input_iterator_test(Iterator i, T v1, T v2)
{
Iterator i1(i);
Iterator i1 = i, i2 = i;
assert(i == i1);
assert(!(i != i1));
assert(i == i1++);
assert(i != ++i2);
// I can see no generic way to create an input iterator
// that is in the domain of== of i and != i.
// The following works for istream_iterator but is not
// guaranteed to work for arbitrary input iterators.
//
// Iterator i2;
//
// assert(i != i2);
// assert(!(i == i2));
trivial_iterator_test(i, i1, v1);
trivial_iterator_test(i, i2, v1);
assert(*i1 == v1);
assert(*i == v1);
// we cannot test for equivalence of (void)++i & (void)i++
// as i is only guaranteed to be single pass.
assert(*i++ == v1);
i1 = i;
assert(i == i1);
assert(!(i != i1));
assert(*i1 == v2);
assert(*i == v2);
// i is dereferencable, so it must be incrementable.
++i;
assert(i == i1);
assert(i == i2);
++i1;
++i2;
// how to test for operator-> ?
trivial_iterator_test(i, i1, v2);
trivial_iterator_test(i, i2, v2);
}
// how to test output iterator?
@@ -146,23 +124,6 @@ void forward_iterator_test(Iterator i, T v1, T v2)
{
input_iterator_test(i, v1, v2);
Iterator i1 = i, i2 = i;
assert(i == i1++);
assert(i != ++i2);
trivial_iterator_test(i, i1, v1);
trivial_iterator_test(i, i2, v1);
++i;
assert(i == i1);
assert(i == i2);
++i1;
++i2;
trivial_iterator_test(i, i1, v2);
trivial_iterator_test(i, i2, v2);
// borland doesn't allow non-type template parameters
# if !defined(__BORLANDC__) || (__BORLANDC__ > 0x551)
lvalue_test<(boost::is_pointer<Iterator>::value)>::check(i);

View File

@@ -5,8 +5,6 @@
// to its suitability for any purpose.
//
// See http://www.boost.org/libs/utility/permutation_iterator.htm for documentation.
#ifndef boost_permutation_iterator_hpp
#define boost_permutation_iterator_hpp

View File

@@ -1,59 +0,0 @@
// (C) Copyright Ronald Garcia 2002. 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/libs/utility/shared_container_iterator.html for documentation.
#ifndef SHARED_CONTAINER_ITERATOR_RG08102002_HPP
#define SHARED_CONTAINER_ITERATOR_RG08102002_HPP
#include "boost/iterator_adaptors.hpp"
#include "boost/shared_ptr.hpp"
#include <utility>
namespace boost {
template <typename Container>
struct shared_container_iterator_policies :
public boost::default_iterator_policies {
typedef boost::shared_ptr<Container> container_ref_t;
container_ref_t container_ref;
shared_container_iterator_policies(container_ref_t const& c) :
container_ref(c) { }
shared_container_iterator_policies() { }
};
template <typename Container>
class shared_container_iterator_generator {
typedef typename Container::iterator iterator;
typedef shared_container_iterator_policies<Container> policy;
public:
typedef boost::iterator_adaptor<iterator,policy> type;
};
template <typename Container>
typename shared_container_iterator_generator<Container>::type
make_shared_container_iterator(typename Container::iterator iter,
boost::shared_ptr<Container> const& container) {
typedef typename shared_container_iterator_generator<Container>::type
iterator;
typedef shared_container_iterator_policies<Container> policy;
return iterator(iter,policy(container));
}
template <typename Container>
std::pair<
typename shared_container_iterator_generator<Container>::type,
typename shared_container_iterator_generator<Container>::type>
make_shared_container_range(boost::shared_ptr<Container> const& container) {
return
std::make_pair(
make_shared_container_iterator(container->begin(),container),
make_shared_container_iterator(container->end(),container));
}
} // namespace boost
#endif // SHARED_CONTAINER_ITERATOR_RG08102002_HPP