Compare commits

...

14 Commits

Author SHA1 Message Date
b43c19a81d This commit was manufactured by cvs2svn to create tag
'Version_1_18_3'.

[SVN r8252]
2000-11-18 14:33:52 +00:00
87a3007c92 completed codewarrior workaround
[SVN r8169]
2000-11-10 16:24:39 +00:00
ea1513596d changed counting iterator policies to a template class to avoid
using template  member functions


[SVN r8157]
2000-11-07 22:22:49 +00:00
9d659841a0 don't use iterator adaptors at all under VC++, even with STLport
until we can figure out why the INTERNAL COMPILER ERROR's are happening


[SVN r8139]
2000-11-04 23:15:10 +00:00
efcbd24229 port to Codewarrior 6.0
[SVN r8107]
2000-11-03 04:25:13 +00:00
3692175786 added base() function
[SVN r8098]
2000-11-02 02:29:53 +00:00
d3b8f893bc changed reference type
[SVN r8033]
2000-10-26 14:04:50 +00:00
cebe553621 ported the graph library to borland
[SVN r7965]
2000-10-17 00:16:05 +00:00
b54236986d work around for VC++ bug, triggered by overloading of remove_edge
[SVN r7860]
2000-09-27 21:02:16 +00:00
24c3beb791 rolled back the removal of the iterator_adaptor alternate code,
added the graph test file


[SVN r7851]
2000-09-26 22:09:34 +00:00
50c9214b82 completed conversion of properties to use _t and enums.
Also noticed that problems regarding iterator_adaptor has
gone away, so I've removed the ifdef's that took it out.


[SVN r7840]
2000-09-26 07:29:12 +00:00
c583cf8730 removed tabs
[SVN r7835]
2000-09-25 21:19:29 +00:00
61d2d43ea5 Use iterator adaptors with STLport.
[SVN r7788]
2000-09-24 01:06:34 +00:00
76efd2456c changes for visual c++ port
[SVN r7764]
2000-09-22 04:18:51 +00:00
2 changed files with 69 additions and 21 deletions

View File

@ -13,10 +13,17 @@
#ifndef BOOST_INTEGER_RANGE_HPP_
#define BOOST_INTEGER_RANGE_HPP_
#ifdef BOOST_MSVC
#include <boost/pending/detail/int_iterator.hpp>
#else
#include <boost/config.hpp>
#if 1
// Still evaluating whether VC++ can handle this.
#define BOOST_USE_ITERATOR_ADAPTORS
#endif
#ifdef BOOST_USE_ITERATOR_ADAPTORS
#include <boost/pending/iterator_adaptors.hpp>
#else
#include <boost/pending/detail/int_iterator.hpp>
#endif
namespace boost {
@ -24,29 +31,34 @@ namespace boost {
//=============================================================================
// Counting Iterator and Integer Range Class
#ifdef BOOST_USE_ITERATOR_ADAPTORS
template <class IntegerType>
struct counting_iterator_policies : public default_iterator_policies
{
template <class IntegerType>
IntegerType dereference(type<IntegerType>, const IntegerType& i) const
const IntegerType&
dereference(type<const IntegerType&>, const IntegerType& i) const
{ return i; }
};
template <class IntegerType>
struct counting_iterator_traits {
typedef IntegerType value_type;
typedef IntegerType reference;
typedef const IntegerType& reference;
typedef value_type* pointer;
typedef std::ptrdiff_t difference_type;
typedef std::random_access_iterator_tag iterator_category;
};
#endif
template <class IntegerType>
struct integer_range {
#ifdef BOOST_MSVC
typedef int_iterator<IntegerType> iterator;
#else
typedef iterator_adaptor<IntegerType, counting_iterator_policies,
#ifdef BOOST_USE_ITERATOR_ADAPTORS
typedef iterator_adaptor<IntegerType,
counting_iterator_policies<IntegerType>,
counting_iterator_traits<IntegerType>, IntegerType> iterator;
#else
typedef int_iterator<IntegerType> iterator;
#endif
typedef iterator const_iterator;
typedef IntegerType value_type;
typedef std::ptrdiff_t difference_type;
@ -71,6 +83,17 @@ protected:
IntegerType m_start, m_finish;
};
template <class IntegerType>
inline integer_range<IntegerType>
make_integer_range(IntegerType first, IntegerType last)
{
return integer_range<IntegerType>(first, last);
}
} // namespace boost
#ifdef BOOST_USE_ITERATOR_ADAPTORS
#undef BOOST_USE_ITERATOR_ADAPTORS
#endif
#endif // BOOST_INTEGER_RANGE_HPP_

View File

@ -20,8 +20,8 @@
// 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
// 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
@ -32,13 +32,16 @@ namespace boost {
template <class T>
struct type {};
//=============================================================================
//============================================================================
// Default policies for iterator adaptors. You can use this as a base
// class if you want to customize particular policies.
struct default_iterator_policies
{
// Some of these members were defined static, but Borland got confused
// and thought they were non-const.
template <class Reference, class Iterator>
static Reference dereference(type<Reference>, const Iterator& x)
Reference dereference(type<Reference>, const Iterator& x) const
{ return *x; }
template <class Iterator>
@ -54,15 +57,16 @@ struct default_iterator_policies
{ x += n; }
template <class Difference, class Iterator1, class Iterator2>
static Difference distance(type<Difference>, const Iterator1& x, const Iterator2& y)
Difference distance(type<Difference>, const Iterator1& x,
const Iterator2& y) const
{ return y - x; }
template <class Iterator1, class Iterator2>
static bool equal(const Iterator1& x, const Iterator2& y)
bool equal(const Iterator1& x, const Iterator2& y) const
{ return x == y; }
template <class Iterator1, class Iterator2>
static bool less(const Iterator1& x, const Iterator2& y)
bool less(const Iterator1& x, const Iterator2& y) const
{ return x < y; }
};
@ -128,7 +132,7 @@ inline bool operator<=(const iterator_comparisons<D1,Base1>& xb,
}
#endif
//=============================================================================
//============================================================================
// iterator_adaptor - A generalized adaptor around an existing
// iterator, which is itself an iterator
//
@ -164,17 +168,18 @@ struct iterator_adaptor :
>
#endif
{
typedef iterator_adaptor<Iterator, Policies, Traits,NonconstIterator> Self;
typedef iterator_adaptor<Iterator, Policies,Traits,NonconstIterator> Self;
public:
typedef typename Traits::difference_type difference_type;
typedef typename Traits::value_type value_type;
typedef typename Traits::pointer pointer;
typedef typename Traits::reference reference;
typedef typename Traits::iterator_category iterator_category;
typedef Iterator iterator_type;
iterator_adaptor() { }
iterator_adaptor(const Iterator& iter, const Policies& p = Policies())
iterator_adaptor(const iterator_type& iter, const Policies& p =Policies())
: m_iter_p(iter, p) {}
#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
@ -223,29 +228,49 @@ public:
{ return *(*this + n); }
Self& operator++() {
#ifdef __MWERKS__
// Odd bug, MWERKS couldn't deduce the type for the member template
// Workaround by explicitly specifying the type.
policies().increment<Iterator>(iter());
#else
policies().increment(iter());
#endif
return *this;
}
Self operator++(int) { Self tmp(*this); ++*this; return tmp; }
Self& operator--() {
#ifdef __MWERKS__
policies().decrement<Iterator>(iter());
#else
policies().decrement(iter());
#endif
return *this;
}
Self operator--(int) { Self tmp(*this); --*this; return tmp; }
Self& operator+=(difference_type n) {
#ifdef __MWERKS__
policies().advance<Iterator>(iter(), n);
#else
policies().advance(iter(), n);
#endif
return *this;
}
Self& operator-=(difference_type n) {
#ifdef __MWERKS__
policies().advance<Iterator>(iter(), -n);
#else
policies().advance(iter(), -n);
#endif
return *this;
}
iterator_type base() const { return m_iter_p.first(); }
private:
typedef Policies policies_type;
compressed_pair<Iterator,Policies> m_iter_p;
@ -475,7 +500,7 @@ struct reverse_iterator_policies
template <class Difference, class Iterator1, class Iterator2>
Difference distance(type<Difference>, const Iterator1& x,
const Iterator2& y) const
const Iterator2& y) const
{ return x - y; }
template <class Iterator1, class Iterator2>