-/*
- Copyright 2005-2007 Adobe Systems Incorporated
-
- Use, modification and distribution are subject to the Boost Software License,
- Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
- http://www.boost.org/LICENSE_1_0.txt).
-
- See http://opensource.adobe.com/gil for most recent version including documentation.
-*/
-
-/*************************************************************************************************/
-
-#ifndef GIL_POSITION_ITERATOR_HPP
-#define GIL_POSITION_ITERATOR_HPP
-
-////////////////////////////////////////////////////////////////////////////////////////
-/// \file
-/// \brief Locator for virtual image views
-/// \author Lubomir Bourdev and Hailin Jin \n
-/// Adobe Systems Incorporated
-/// \date 2005-2007 \n Last updated on February 12, 2007
-///
-////////////////////////////////////////////////////////////////////////////////////////
+//
+// Copyright 2005-2007 Adobe Systems Incorporated
+//
+// Distributed under the Boost Software License, Version 1.0
+// See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt
+//
+#ifndef BOOST_GIL_POSITION_ITERATOR_HPP
+#define BOOST_GIL_POSITION_ITERATOR_HPP
+
+#include <boost/gil/locator.hpp>
#include <boost/iterator/iterator_facade.hpp>
-#include "locator.hpp"
+
+#include <type_traits>
namespace boost { namespace gil {
/// \defgroup PixelIteratorModelVirtual position_iterator
/// \ingroup PixelIteratorModel
-/// \brief An iterator that remembers its current X,Y position and invokes a function object with it upon dereferencing. Models PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept. Used to create virtual image views.
-
+/// \brief An iterator that remembers its current X,Y position and invokes a function object with it upon dereferencing.
+/// Models PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept. Used to create virtual image views.
-/// \brief An iterator that remembers its current X,Y position and invokes a function object with it upon dereferencing. Models PixelIteratorConcept. Used to create virtual image views.
-/// Models: StepIteratorConcept, PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept
+/// \brief An iterator that remembers its current X,Y position and invokes a function object with it upon dereferencing.
+/// Used to create virtual image views.
+/// Models: StepIteratorConcept, PixelIteratorConcept, PixelBasedConcept, HasDynamicXStepTypeConcept
/// \ingroup PixelIteratorModelVirtual PixelBasedModel
-template <typename Deref, // A function object that given a point returns a pixel reference. Models PixelDereferenceAdaptorConcept
- int Dim> // the dimension to advance along
+/// \tparam Deref A function object that given a point returns a pixel reference. Models PixelDereferenceAdaptorConcept
+/// \tparam Dim Dimension to advance along
+template <typename Deref, int Dim>
struct position_iterator : public iterator_facade<position_iterator<Deref,Dim>,
typename Deref::value_type,
std::random_access_iterator_tag,
typename Deref::reference,
typename Deref::argument_type::template axis<Dim>::coord_t> {
- typedef iterator_facade<position_iterator<Deref,Dim>,
+ using parent_t = iterator_facade<position_iterator<Deref,Dim>,
typename Deref::value_type,
std::random_access_iterator_tag,
typename Deref::reference,
- typename Deref::argument_type::template axis<Dim>::coord_t> parent_t;
- typedef typename parent_t::difference_type difference_type;
- typedef typename parent_t::reference reference;
- typedef typename Deref::argument_type point_t;
+ typename Deref::argument_type::template axis<Dim>::coord_t>;
+ using difference_type = typename parent_t::difference_type;
+ using reference = typename parent_t::reference;
+ using point_t = typename Deref::argument_type;
position_iterator() {}
position_iterator(const point_t& p, const point_t& step, const Deref& d) : _p(p), _step(step), _d(d) {}
bool equal(const position_iterator& it) const { return _p==it._p; }
};
-template <typename Deref,int Dim>
+template <typename Deref,int Dim>
struct const_iterator_type<position_iterator<Deref,Dim> > {
- typedef position_iterator<typename Deref::const_t,Dim> type;
+ using type = position_iterator<typename Deref::const_t,Dim>;
};
-template <typename Deref,int Dim>
-struct iterator_is_mutable<position_iterator<Deref,Dim> > : public mpl::bool_<Deref::is_mutable> {
+template <typename Deref, int Dim>
+struct iterator_is_mutable<position_iterator<Deref, Dim>>
+ : std::integral_constant<bool, Deref::is_mutable>
+{
};
/////////////////////////////
// PixelBasedConcept
/////////////////////////////
-template <typename Deref,int Dim>
+template <typename Deref,int Dim>
struct color_space_type<position_iterator<Deref,Dim> > : public color_space_type<typename Deref::value_type> {};
-template <typename Deref,int Dim>
+template <typename Deref,int Dim>
struct channel_mapping_type<position_iterator<Deref,Dim> > : public channel_mapping_type<typename Deref::value_type> {};
-template <typename Deref,int Dim>
-struct is_planar<position_iterator<Deref,Dim> > : public mpl::false_ {};
+template <typename Deref,int Dim>
+struct is_planar<position_iterator<Deref, Dim>> : std::false_type {};
-template <typename Deref,int Dim>
+template <typename Deref,int Dim>
struct channel_type<position_iterator<Deref,Dim> > : public channel_type<typename Deref::value_type> {};
/////////////////////////////
// HasDynamicXStepTypeConcept
/////////////////////////////
-template <typename Deref,int Dim>
+template <typename Deref,int Dim>
struct dynamic_x_step_type<position_iterator<Deref,Dim> > {
- typedef position_iterator<Deref,Dim> type;
+ using type = position_iterator<Deref,Dim>;
};
} } // namespace boost::gil