#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct Pred
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct gen_test
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct gen_test
{
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct is_odd
{
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct is_odd
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct is_odd
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct is_odd
{
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct is_odd
{
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template<class Iter1, class Iter2>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template<class InIter1, class InIter2, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct count_equal
{
#include <memory>
#endif
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct count_equal
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct test1
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct test1
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter1, class Iter2>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct count_equal
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct for_each_test
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct test1
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter1, class Iter2>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
struct count_equal
{
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
int main()
{
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <vector>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter, class T>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter1, class Iter2>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter1, class Iter2>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter1, class InIter2, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class InIter1, class InIter2, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
#include <cstdio>
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
#include <cstdio>
#include <algorithm>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
#include <cstdio>
#include <functional>
#include <cassert>
-#include "../../iterators.h"
+#include "../../../iterators.h"
#include <cstdio>
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter1, class Iter2, class OutIter>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter>
void
#include <algorithm>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter>
void
#include <functional>
#include <cassert>
-#include "../../../iterators.h"
+#include "../../../../iterators.h"
template <class Iter>
void
+++ /dev/null
-#ifndef ITERATORS_H
-#define ITERATORS_H
-
-#include <iterator>
-
-template <class It>
-class output_iterator
-{
- It it_;
-
- template <class U> friend class output_iterator;
-public:
- typedef std::output_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- explicit output_iterator(It it) : it_(it) {}
- template <class U>
- output_iterator(const output_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
-
- output_iterator& operator++() {++it_; return *this;}
- output_iterator operator++(int)
- {output_iterator tmp(*this); ++(*this); return tmp;}
-};
-
-template <class Iter>
-inline
-Iter
-base(output_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class input_iterator
-{
- It it_;
-
- template <class U> friend class input_iterator;
-public:
- typedef std::input_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- explicit input_iterator(It it) : it_(it) {}
- template <class U>
- input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- input_iterator& operator++() {++it_; return *this;}
- input_iterator operator++(int)
- {input_iterator tmp(*this); ++(*this); return tmp;}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const input_iterator<T>& x, const input_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const input_iterator<T>& x, const input_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class Iter>
-inline
-Iter
-base(input_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class forward_iterator
-{
- It it_;
-
- template <class U> friend class forward_iterator;
-public:
- typedef std::forward_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- forward_iterator() : it_() {}
- explicit forward_iterator(It it) : it_(it) {}
- template <class U>
- forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- forward_iterator& operator++() {++it_; return *this;}
- forward_iterator operator++(int)
- {forward_iterator tmp(*this); ++(*this); return tmp;}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const forward_iterator<T>& x, const forward_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const forward_iterator<T>& x, const forward_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class Iter>
-inline
-Iter
-base(forward_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class bidirectional_iterator
-{
- It it_;
-
- template <class U> friend class bidirectional_iterator;
-public:
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- bidirectional_iterator() : it_() {}
- explicit bidirectional_iterator(It it) : it_(it) {}
- template <class U>
- bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- bidirectional_iterator& operator++() {++it_; return *this;}
- bidirectional_iterator operator++(int)
- {bidirectional_iterator tmp(*this); ++(*this); return tmp;}
-
- bidirectional_iterator& operator--() {--it_; return *this;}
- bidirectional_iterator operator--(int)
- {bidirectional_iterator tmp(*this); --(*this); return tmp;}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class Iter>
-inline
-Iter
-base(bidirectional_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class random_access_iterator
-{
- It it_;
-
- template <class U> friend class random_access_iterator;
-public:
- typedef std::random_access_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- random_access_iterator() : it_() {}
- explicit random_access_iterator(It it) : it_(it) {}
- template <class U>
- random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- random_access_iterator& operator++() {++it_; return *this;}
- random_access_iterator operator++(int)
- {random_access_iterator tmp(*this); ++(*this); return tmp;}
-
- random_access_iterator& operator--() {--it_; return *this;}
- random_access_iterator operator--(int)
- {random_access_iterator tmp(*this); --(*this); return tmp;}
-
- random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;}
- random_access_iterator operator+(difference_type n) const
- {random_access_iterator tmp(*this); tmp += n; return tmp;}
- friend random_access_iterator operator+(difference_type n, random_access_iterator x)
- {x += n; return x;}
- random_access_iterator& operator-=(difference_type n) {return *this += -n;}
- random_access_iterator operator-(difference_type n) const
- {random_access_iterator tmp(*this); tmp -= n; return tmp;}
-
- reference operator[](difference_type n) const {return it_[n];}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class T, class U>
-inline
-bool
-operator<(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return x.base() < y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator<=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return !(y < x);
-}
-
-template <class T, class U>
-inline
-bool
-operator>(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return y < x;
-}
-
-template <class T, class U>
-inline
-bool
-operator>=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return !(x < y);
-}
-
-template <class T, class U>
-inline
-typename std::iterator_traits<T>::difference_type
-operator-(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return x.base() - y.base();
-}
-
-template <class Iter>
-inline
-Iter
-base(random_access_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class Iter>
-inline
-Iter
-base(Iter i)
-{
- return i;
-}
-
-#endif // ITERATORS_H
return x.base() - y.base();
}
+template <class Iter>
+inline Iter base(output_iterator<Iter> i) { return i.base(); }
+
+template <class Iter>
+inline Iter base(input_iterator<Iter> i) { return i.base(); }
+
+template <class Iter>
+inline Iter base(forward_iterator<Iter> i) { return i.base(); }
+
+template <class Iter>
+inline Iter base(bidirectional_iterator<Iter> i) { return i.base(); }
+
+template <class Iter>
+inline Iter base(random_access_iterator<Iter> i) { return i.base(); }
+
+template <class Iter> // everything else
+inline Iter base(Iter i) { return i; }
+
#endif // ITERATORS_H
assert(r1.base() == u);
}
-struct base {};
-struct derived : base {};
+struct Base {};
+struct Derived : Base {};
int main()
{
- derived d;
+ Derived d;
- test<input_iterator<base*> >(input_iterator<derived*>(&d));
- test<forward_iterator<base*> >(forward_iterator<derived*>(&d));
- test<bidirectional_iterator<base*> >(bidirectional_iterator<derived*>(&d));
- test<random_access_iterator<const base*> >(random_access_iterator<derived*>(&d));
- test<base*>(&d);
+ test<input_iterator<Base*> >(input_iterator<Derived*>(&d));
+ test<forward_iterator<Base*> >(forward_iterator<Derived*>(&d));
+ test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+ test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+ test<Base*>(&d);
}
assert(&rr == &r1);
}
-struct base {};
-struct derived : base {};
+struct Base {};
+struct Derived : Base {};
int main()
{
- derived d;
+ Derived d;
- test<input_iterator<base*> >(input_iterator<derived*>(&d));
- test<forward_iterator<base*> >(forward_iterator<derived*>(&d));
- test<bidirectional_iterator<base*> >(bidirectional_iterator<derived*>(&d));
- test<random_access_iterator<const base*> >(random_access_iterator<derived*>(&d));
- test<base*>(&d);
+ test<input_iterator<Base*> >(input_iterator<Derived*>(&d));
+ test<forward_iterator<Base*> >(forward_iterator<Derived*>(&d));
+ test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+ test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+ test<Base*>(&d);
}
assert(r1.base() == u);
}
-struct base {};
-struct derived : base {};
+struct Base {};
+struct Derived : Base {};
int main()
{
- derived d;
+ Derived d;
- test<bidirectional_iterator<base*> >(bidirectional_iterator<derived*>(&d));
- test<random_access_iterator<const base*> >(random_access_iterator<derived*>(&d));
- test<base*>(&d);
+ test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+ test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+ test<Base*>(&d);
}
assert(&rr == &r1);
}
-struct base {};
-struct derived : base {};
+struct Base {};
+struct Derived : Base {};
int main()
{
- derived d;
+ Derived d;
- test<bidirectional_iterator<base*> >(bidirectional_iterator<derived*>(&d));
- test<random_access_iterator<const base*> >(random_access_iterator<derived*>(&d));
- test<base*>(&d);
+ test<bidirectional_iterator<Base*> >(bidirectional_iterator<Derived*>(&d));
+ test<random_access_iterator<const Base*> >(random_access_iterator<Derived*>(&d));
+ test<Base*>(&d);
}
#include <numeric>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class Iter, class T>
void
#include <functional>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class Iter, class T>
void
#include <numeric>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <numeric>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class Iter1, class Iter2, class T>
void
#include <functional>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class Iter1, class Iter2, class T>
void
+++ /dev/null
-#ifndef ITERATORS_H
-#define ITERATORS_H
-
-#include <iterator>
-
-template <class It>
-class output_iterator
-{
- It it_;
-
- template <class U> friend class output_iterator;
-public:
- typedef std::output_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- explicit output_iterator(It it) : it_(it) {}
- template <class U>
- output_iterator(const output_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
-
- output_iterator& operator++() {++it_; return *this;}
- output_iterator operator++(int)
- {output_iterator tmp(*this); ++(*this); return tmp;}
-};
-
-template <class Iter>
-inline
-Iter
-base(output_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class input_iterator
-{
- It it_;
-
- template <class U> friend class input_iterator;
-public:
- typedef std::input_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- explicit input_iterator(It it) : it_(it) {}
- template <class U>
- input_iterator(const input_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- input_iterator& operator++() {++it_; return *this;}
- input_iterator operator++(int)
- {input_iterator tmp(*this); ++(*this); return tmp;}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const input_iterator<T>& x, const input_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const input_iterator<T>& x, const input_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class Iter>
-inline
-Iter
-base(input_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class forward_iterator
-{
- It it_;
-
- template <class U> friend class forward_iterator;
-public:
- typedef std::forward_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- forward_iterator() : it_() {}
- explicit forward_iterator(It it) : it_(it) {}
- template <class U>
- forward_iterator(const forward_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- forward_iterator& operator++() {++it_; return *this;}
- forward_iterator operator++(int)
- {forward_iterator tmp(*this); ++(*this); return tmp;}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const forward_iterator<T>& x, const forward_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const forward_iterator<T>& x, const forward_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class Iter>
-inline
-Iter
-base(forward_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class bidirectional_iterator
-{
- It it_;
-
- template <class U> friend class bidirectional_iterator;
-public:
- typedef std::bidirectional_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- bidirectional_iterator() : it_() {}
- explicit bidirectional_iterator(It it) : it_(it) {}
- template <class U>
- bidirectional_iterator(const bidirectional_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- bidirectional_iterator& operator++() {++it_; return *this;}
- bidirectional_iterator operator++(int)
- {bidirectional_iterator tmp(*this); ++(*this); return tmp;}
-
- bidirectional_iterator& operator--() {--it_; return *this;}
- bidirectional_iterator operator--(int)
- {bidirectional_iterator tmp(*this); --(*this); return tmp;}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const bidirectional_iterator<T>& x, const bidirectional_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class Iter>
-inline
-Iter
-base(bidirectional_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class It>
-class random_access_iterator
-{
- It it_;
-
- template <class U> friend class random_access_iterator;
-public:
- typedef std::random_access_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::difference_type difference_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- It base() const {return it_;}
-
- random_access_iterator() : it_() {}
- explicit random_access_iterator(It it) : it_(it) {}
- template <class U>
- random_access_iterator(const random_access_iterator<U>& u) :it_(u.it_) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- random_access_iterator& operator++() {++it_; return *this;}
- random_access_iterator operator++(int)
- {random_access_iterator tmp(*this); ++(*this); return tmp;}
-
- random_access_iterator& operator--() {--it_; return *this;}
- random_access_iterator operator--(int)
- {random_access_iterator tmp(*this); --(*this); return tmp;}
-
- random_access_iterator& operator+=(difference_type n) {it_ += n; return *this;}
- random_access_iterator operator+(difference_type n) const
- {random_access_iterator tmp(*this); tmp += n; return tmp;}
- friend random_access_iterator operator+(difference_type n, random_access_iterator x)
- {x += n; return x;}
- random_access_iterator& operator-=(difference_type n) {return *this += -n;}
- random_access_iterator operator-(difference_type n) const
- {random_access_iterator tmp(*this); tmp -= n; return tmp;}
-
- reference operator[](difference_type n) const {return it_[n];}
-};
-
-template <class T, class U>
-inline
-bool
-operator==(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return x.base() == y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator!=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return !(x == y);
-}
-
-template <class T, class U>
-inline
-bool
-operator<(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return x.base() < y.base();
-}
-
-template <class T, class U>
-inline
-bool
-operator<=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return !(y < x);
-}
-
-template <class T, class U>
-inline
-bool
-operator>(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return y < x;
-}
-
-template <class T, class U>
-inline
-bool
-operator>=(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return !(x < y);
-}
-
-template <class T, class U>
-inline
-typename std::iterator_traits<T>::difference_type
-operator-(const random_access_iterator<T>& x, const random_access_iterator<U>& y)
-{
- return x.base() - y.base();
-}
-
-template <class Iter>
-inline
-Iter
-base(random_access_iterator<Iter> i)
-{
- return i.base();
-}
-
-template <class Iter>
-inline
-Iter
-base(Iter i)
-{
- return i;
-}
-
-#endif // ITERATORS_H
#include <numeric>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class InIter>
void
#include <numeric>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void
#include <functional>
#include <cassert>
-#include "../iterators.h"
+#include "../../../iterators.h"
template <class InIter, class OutIter>
void