Make wxVector reverse iterators conform to iterator requirements
This is similar to a recent commit adding the missing typedefs to wxList iterators and defines the types required by the iterator concept in wxVector::reverse_iterator and const_reverse_iterator classes (simple iterators are just pointers and are already covered by the standard iterator_traits specialization).
This commit is contained in:
@@ -33,6 +33,9 @@ inline void wxVectorSort(wxVector<T>& v)
|
||||
#include "wx/meta/if.h"
|
||||
|
||||
#include "wx/beforestd.h"
|
||||
#if wxUSE_STD_CONTAINERS_COMPATIBLY
|
||||
#include <iterator>
|
||||
#endif
|
||||
#include <new> // for placement new
|
||||
#include "wx/afterstd.h"
|
||||
|
||||
@@ -172,6 +175,14 @@ public:
|
||||
class reverse_iterator
|
||||
{
|
||||
public:
|
||||
#if wxUSE_STD_CONTAINERS_COMPATIBLY
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
#endif
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef value_type* pointer;
|
||||
typedef value_type& reference;
|
||||
|
||||
reverse_iterator() : m_ptr(NULL) { }
|
||||
explicit reverse_iterator(iterator it) : m_ptr(it) { }
|
||||
reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
|
||||
@@ -218,6 +229,14 @@ public:
|
||||
class const_reverse_iterator
|
||||
{
|
||||
public:
|
||||
#if wxUSE_STD_CONTAINERS_COMPATIBLY
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
#endif
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef T value_type;
|
||||
typedef const value_type* pointer;
|
||||
typedef const value_type& reference;
|
||||
|
||||
const_reverse_iterator() : m_ptr(NULL) { }
|
||||
explicit const_reverse_iterator(const_iterator it) : m_ptr(it) { }
|
||||
const_reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
|
||||
|
Reference in New Issue
Block a user