Compare commits

..

14 Commits

Author SHA1 Message Date
577969e6a5 This commit was manufactured by cvs2svn to create tag
'Version_1_29_0'.

[SVN r15904]
2002-10-11 15:17:55 +00:00
7b364550a6 This commit was manufactured by cvs2svn to create branch 'RC_1_29_0'.
[SVN r15460]
2002-09-19 20:49:39 +00:00
5bacd289b6 Roll back MPL v2 fix as it's no longer needed and was breaking Borland
[SVN r15264]
2002-09-11 14:46:40 +00:00
77c1698c6e mpl_v2 branch checkin
[SVN r15258]
2002-09-11 05:35:41 +00:00
2c302ee549 operator[] workaround from "Yitzhak Sapir" <yitzhaks@actimize.com>
[SVN r15244]
2002-09-09 21:15:41 +00:00
a586f20d19 Added Shared Container Iterator adaptor to iterator adaptor library.
[SVN r15169]
2002-09-05 14:05:29 +00:00
34c159dd8d Minor sunpro compartibility fix
[SVN r14741]
2002-08-08 16:42:18 +00:00
b22a3adc02 Add BOOST_NO_STD_ITERATOR_TRAITS workaround
[SVN r14663]
2002-08-03 22:45:13 +00:00
4a24e0f401 Fixed for VC7.1
[SVN r14433]
2002-07-13 12:11:06 +00:00
3844edc4bf Fixed input iterator requirements. For a == b a++ == b++ is no longer
required. See 24.1.1/3 for details. (Thomas Witt)


[SVN r13716]
2002-05-07 11:56:08 +00:00
fdd1601ba4 Added new config macro BOOST_HAS_MS_INT64 to detect presence of __int64 data type.
Modified boost source to use BOOST_HAS_LONG_LONG and BOOST_HAS_MS_INT64
   where appropriate to do so.


[SVN r13714]
2002-05-07 11:24:29 +00:00
e9b33b336c added typename keyword (Bertolt Mildner)
[SVN r13675]
2002-05-06 06:44:14 +00:00
2574365b5c added support for reference named_parameters
[SVN r13638]
2002-05-03 13:52:39 +00:00
12b9366f33 BOOST_NO_LIMITS should not be used by user code; use <boost/limits.hpp> instead
BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS should not be defined when
BOOST_NO_LIMITS is defined


[SVN r13340]
2002-04-01 18:57:43 +00:00
4 changed files with 139 additions and 36 deletions

View File

@ -56,9 +56,7 @@
# include <boost/type_traits.hpp>
# include <boost/detail/numeric_traits.hpp>
# include <boost/static_assert.hpp>
# ifndef BOOST_NO_LIMITS
# include <limits>
# endif
# include <boost/limits.hpp>
namespace boost {
@ -135,7 +133,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(ULLONG_MAX) || defined(ULONG_LONG_MAX)
# if defined(BOOST_HAS_LONG_LONG)
BOOST_STATIC_CONSTANT(bool,
value = (
std::numeric_limits<T>::is_specialized

View File

@ -124,6 +124,7 @@
# 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>
@ -147,7 +148,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 +158,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 +383,7 @@ namespace detail {
};
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) || defined(BOOST_NO_STD_ITERATOR_TRAITS)
// Select default pointer and reference types for adapted non-pointer
// iterators based on the iterator and the value_type. Poor man's partial
@ -625,7 +626,7 @@ namespace detail {
template <class Value>
struct is_named_parameter
{
enum { value = is_convertible<Value, named_template_param_base>::value };
enum { value = is_convertible< typename add_reference< Value >::type, add_reference< named_template_param_base >::type >::value };
};
# if defined(__MWERKS__) && __MWERKS__ <= 0x2406 // workaround for broken is_convertible implementation
@ -761,12 +762,18 @@ 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 !defined(BOOST_MSVC)
# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
# define BOOST_ARG_DEPENDENT_TYPENAME typename
# else
# define BOOST_ARG_DEPENDENT_TYPENAME
@ -855,9 +862,9 @@ struct iterator_adaptor :
policies().initialize(base());
}
#if defined(BOOST_MSVC) || defined(__BORLANDC__)
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 || defined(__BORLANDC__)
// This is required to prevent a bug in how VC++ generates
// the assignment operator for compressed_pairv
// the assignment operator for compressed_pair
iterator_adaptor& operator= (const iterator_adaptor& x) {
m_iter_p = x.m_iter_p;
return *this;
@ -880,7 +887,8 @@ struct iterator_adaptor :
# pragma warning(pop)
#endif
value_type operator[](difference_type n) const
template <class diff_type>
typename detail::dependent<diff_type, value_type>::type operator[](diff_type n) const
{ return *(*this + n); }
self& operator++() {
@ -1097,7 +1105,7 @@ struct indirect_iterator_policies : public default_iterator_policies
};
namespace detail {
# if !defined(BOOST_MSVC) // stragely instantiated even when unused! Maybe try a recursive template someday ;-)
# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // strangely 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;
@ -1110,12 +1118,12 @@ namespace detail {
template <class OuterIterator, // Mutable or Immutable, does not matter
class Value
#if !defined(BOOST_MSVC)
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::value_type
#endif
, class Reference
#if !defined(BOOST_MSVC)
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::reference
#else
@ -1124,7 +1132,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 !defined(BOOST_MSVC)
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::pointer
#else
@ -1139,28 +1147,28 @@ struct indirect_iterator_generator
template <class OuterIterator, // Mutable or Immutable, does not matter
class Value
#if !defined(BOOST_MSVC)
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::value_type
#endif
, class Reference
#if !defined(BOOST_MSVC)
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::reference
#else
= Value &
#endif
, class ConstReference = const Value&
, class ConstReference = Value const&
, class Category = BOOST_ARG_DEPENDENT_TYPENAME boost::detail::iterator_traits<
OuterIterator>::iterator_category
, class Pointer
#if !defined(BOOST_MSVC)
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
= BOOST_ARG_DEPENDENT_TYPENAME detail::traits_of_value_type<
OuterIterator>::pointer
#else
= Value*
#endif
, class ConstPointer = const Value*
, class ConstPointer = Value const*
>
struct indirect_iterator_pair_generator
{
@ -1170,7 +1178,7 @@ struct indirect_iterator_pair_generator
Value, ConstReference,Category,ConstPointer>::type const_iterator;
};
#ifndef BOOST_MSVC
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300
template <class OuterIterator>
inline typename indirect_iterator_generator<OuterIterator>::type
make_indirect_iterator(OuterIterator base)
@ -1392,7 +1400,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));
#ifndef BOOST_MSVC // I don't have any idea why this occurs, but it doesn't seem to hurt too badly.
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 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,6 +5,10 @@
// 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)
@ -74,22 +78,40 @@ 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, i2 = i;
Iterator i1(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;
assert(!(i != i1));
trivial_iterator_test(i, i1, v2);
trivial_iterator_test(i, i2, v2);
// 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));
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;
// how to test for operator-> ?
}
// how to test output iterator?
@ -124,6 +146,23 @@ 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

@ -0,0 +1,58 @@
// (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.
#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