* Class that represents an iterator pointing to a contiguous interval
* $[a,b[$ as returned by IndexSet::begin_interval().
*/
- class IntervalIterator : public std::iterator<std::forward_iterator_tag,IntervalAccessor>
+ class IntervalIterator
{
public:
/**
*/
int operator - (const IntervalIterator &p) const;
+ /**
+ * Mark the class as forward iterator and declare some typedefs which are
+ * standard for iterators and are used by algorithms to enquire about the
+ * specifics of the iterators they work on.
+ */
+ typedef std::forward_iterator_tag iterator_category;
+ typedef IntervalAccessor value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef IntervalAccessor *pointer;
+ typedef IntervalAccessor &reference;
+
private:
/**
* Accessor that contains what IndexSet and interval we are pointing at.
* Class that represents an iterator pointing to a single element in the
* IndexSet as returned by IndexSet::begin().
*/
- class ElementIterator : public std::iterator<std::forward_iterator_tag,size_type>
+ class ElementIterator
{
public:
/**
*/
std::ptrdiff_t operator - (const ElementIterator &p) const;
+ /**
+ * Mark the class as forward iterator and declare some typedefs which are
+ * standard for iterators and are used by algorithms to enquire about the
+ * specifics of the iterators they work on.
+ */
+ typedef std::forward_iterator_tag iterator_category;
+ typedef size_type value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef size_type *pointer;
+ typedef size_type &reference;
+
private:
/**
* Advance iterator by one.
* A class that implements the semantics of iterators over iterators as
* discussed in the design sections of the IteratorRange class.
*/
- class IteratorOverIterators : public std::iterator<std::forward_iterator_tag, Iterator,
- typename Iterator::difference_type>
+ class IteratorOverIterators
{
public:
/**
*/
bool operator != (const IteratorOverIterators &i_o_i);
+ /**
+ * Mark the class as forward iterator and declare some typedefs which are
+ * standard for iterators and are used by algorithms to enquire about the
+ * specifics of the iterators they work on.
+ */
+ typedef std::forward_iterator_tag iterator_category;
+ typedef Iterator value_type;
+ typedef typename Iterator::difference_type difference_type;
+ typedef Iterator *pointer;
+ typedef Iterator &reference;
+
private:
/**
* The object this iterator currently points to.
* @author documentation update Guido Kanschat, 2004
*/
template <typename Accessor>
-class TriaRawIterator : public std::iterator<std::bidirectional_iterator_tag,Accessor>
+class TriaRawIterator
{
public:
/**
*/
std::size_t memory_consumption () const;
+ /**
+ * Mark the class as bidirectional iterator and declare some typedefs which
+ * are standard for iterators and are used by algorithms to enquire about the
+ * specifics of the iterators they work on.
+ */
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef Accessor value_type;
+ typedef int difference_type;
+ typedef Accessor *pointer;
+ typedef Accessor &reference;
/**@name Exceptions*/
/*@{*/
TriaIterator<Accessor> operator -- (int);
/*@}*/
+ /**
+ * Declare some typedefs which are standard for iterators and are used
+ * by algorithms to enquire about the specifics of the iterators they
+ * work on.
+ */
+ typedef typename TriaRawIterator<Accessor>::iterator_category iterator_category;
+ typedef typename TriaRawIterator<Accessor>::value_type value_type;
+ typedef typename TriaRawIterator<Accessor>::pointer pointer;
+ typedef typename TriaRawIterator<Accessor>::reference reference;
+ typedef typename TriaRawIterator<Accessor>::difference_type difference_type;
+
/**
* Exception
*/
TriaActiveIterator<Accessor> operator -- (int);
/*@}*/
+ /**
+ * Declare some typedefs which are standard for iterators and are used
+ * by algorithms to enquire about the specifics of the iterators they
+ * work on.
+ */
+ typedef typename TriaIterator<Accessor>::iterator_category iterator_category;
+ typedef typename TriaIterator<Accessor>::value_type value_type;
+ typedef typename TriaIterator<Accessor>::pointer pointer;
+ typedef typename TriaIterator<Accessor>::reference reference;
+ typedef typename TriaIterator<Accessor>::difference_type difference_type;
+
/**
* Exception
*/
* @author Wolfgang Bangerth, 2001
*/
template <class BlockVectorType, bool Constness>
- class Iterator :
- public std::iterator<std::random_access_iterator_tag,
- typename Types<BlockVectorType,Constness>::value_type>
+ class Iterator
{
public:
/**
* by algorithms to enquire about the specifics of the iterators they
* work on.
*/
- typedef std::random_access_iterator_tag iterator_type;
+ typedef std::random_access_iterator_tag iterator_category;
typedef std::ptrdiff_t difference_type;
typedef typename BlockVectorType::reference reference;
typedef value_type *pointer;
* of the particle class and the particle container.
*/
template<int dim, int spacedim=dim>
- class ParticleIterator: public std::iterator<std::bidirectional_iterator_tag,ParticleAccessor<dim,spacedim> >
+ class ParticleIterator
{
public:
/**
*/
ParticleIterator operator -- (int);
+ /**
+ * Mark the class as bidirectional iterator and declare some typedefs which
+ * are standard for iterators and are used by algorithms to enquire about
+ * the specifics of the iterators they work on.
+ */
+ typedef std::bidirectional_iterator_tag iterator_category;
+ typedef ParticleAccessor<dim,spacedim> value_type;
+ typedef std::ptrdiff_t difference_type;
+ typedef ParticleAccessor<dim,spacedim> *pointer;
+ typedef ParticleAccessor<dim,spacedim> &reference;
+
private:
/**
* The accessor to the actual particle.
{
// use the rotate defined
// in <algorithms>
- rotate(line_counterclock, line_counterclock+1, line_counterclock+4);
+ std::rotate(line_counterclock, line_counterclock+1, line_counterclock+4);
// update the quads with
// rotated lines (i runs in
// lexicographic ordering)
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2018 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+
+
+// Test that all the iterator types are defined.
+
+#include <deal.II/base/index_set.h>
+#include <deal.II/base/iterator_range.h>
+#include <deal.II/grid/tria_accessor.h>
+#include <deal.II/grid/tria_iterator.h>
+#include <deal.II/lac/block_vector_base.h>
+#include <deal.II/lac/block_vector.h>
+#include <deal.II/particles/particle_iterator.h>
+#include "../tests.h"
+
+int main ()
+{
+ initlog();
+
+ typedef std::iterator_traits<TriaRawIterator<TriaAccessor<2,2,2>>>::iterator_category tria_raw_iterator_category;
+ typedef std::iterator_traits<TriaIterator<TriaAccessor<2,2,2>>>::iterator_category tria_iterator_category;
+ typedef std::iterator_traits<TriaActiveIterator<TriaAccessor<2,2,2>>>::iterator_category tria_active_iterator_category;
+
+ typedef std::iterator_traits<Particles::ParticleIterator<2>>::iterator_category particle_category;
+
+ typedef std::iterator_traits<IteratorRange<Particles::ParticleIterator<2>>::IteratorOverIterators>::iterator_category iterator_over_iterator_category;
+
+ typedef std::iterator_traits<internal::BlockVectorIterators::Iterator<BlockVector<double>, false>>::iterator_category block_vector_base_iterator_category;
+
+ typedef std::iterator_traits<IndexSet::IntervalIterator>::iterator_category intervall_iterator_category;
+ typedef std::iterator_traits<IndexSet::ElementIterator>::iterator_category element_iterator_category;
+
+ deallog << "OK" << std::endl;
+}
+
+
+
--- /dev/null
+
+DEAL::OK