Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions luabind/detail/crtp_iterator.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef LUABIND_CRTP_ITERATOR_HPP_INCLUDED
#ifndef LUABIND_CRTP_ITERATOR_HPP_INCLUDED
#define LUABIND_CRTP_ITERATOR_HPP_INCLUDED

#include <iterator>
Expand All @@ -7,13 +7,16 @@ namespace luabind {
namespace detail {

template< typename CRTP, typename Category, typename ValueType, typename ReferenceType = ValueType&, typename DifferenceType = ptrdiff_t >
class crtp_iterator :
public std::iterator<Category, ValueType, DifferenceType, ValueType*, ReferenceType >
class crtp_iterator
{
public:
using base_type = std::iterator<Category, ValueType, DifferenceType, ValueType*, ReferenceType >;

using iterator_category = Category;
using value_type = ValueType;
using difference_type = DifferenceType;
using pointer = ValueType * ;
using reference = ReferenceType;

public:
CRTP& operator++()
{
upcast().increment();
Expand All @@ -37,12 +40,12 @@ namespace luabind {
return !upcast().equal(rhs);
}

typename base_type::reference operator*()
reference operator*()
{
return upcast().dereference();
}

typename base_type::reference operator->()
reference operator->()
{
return upcast().dereference();
}
Expand Down