update boost
This commit is contained in:
@@ -12,18 +12,22 @@
|
||||
|
||||
#include <boost/iterator/iterator_facade.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,
|
||||
@@ -39,20 +43,34 @@ struct position_iterator : public iterator_facade<position_iterator<Deref,Dim>,
|
||||
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) {}
|
||||
position_iterator(point_t const& p, point_t const& step, Deref const& d) : _p(p), _step(step), _d(d) {}
|
||||
|
||||
position_iterator(const position_iterator& p) : _p(p._p), _step(p._step), _d(p._d) {}
|
||||
template <typename D> position_iterator(const position_iterator<D,Dim>& p) : _p(p._p), _step(p._step), _d(p._d) {}
|
||||
position_iterator& operator=(const position_iterator& p) { _p=p._p; _d=p._d; _step=p._step; return *this; }
|
||||
position_iterator(position_iterator const& p) : _p(p._p), _step(p._step), _d(p._d) {}
|
||||
|
||||
template <typename D>
|
||||
position_iterator(position_iterator<D,Dim> const& p) : _p(p._p), _step(p._step), _d(p._d) {}
|
||||
|
||||
auto operator=(position_iterator const& p) -> position_iterator&
|
||||
{
|
||||
_p=p._p;
|
||||
_d=p._d;
|
||||
_step=p._step;
|
||||
return *this;
|
||||
}
|
||||
|
||||
const point_t& pos() const { return _p; }
|
||||
const point_t& step() const { return _step; }
|
||||
const Deref& deref_fn() const { return _d; }
|
||||
auto pos() const -> point_t const& { return _p; }
|
||||
auto step() const -> point_t const& { return _step; }
|
||||
auto deref_fn() const -> Deref const& { return _d; }
|
||||
|
||||
void set_step(difference_type s) { _step[Dim]=s; }
|
||||
/// For some reason operator[] provided by iterator_adaptor returns a custom class that is convertible to reference
|
||||
/// We require our own reference because it is registered in iterator_traits
|
||||
reference operator[](difference_type d) const { point_t p=_p; p[Dim]+=d*_step[Dim]; return _d(p); }
|
||||
auto operator[](difference_type d) const -> reference
|
||||
{
|
||||
point_t p=_p;
|
||||
p[Dim]+=d*_step[Dim];
|
||||
return _d(p);
|
||||
}
|
||||
|
||||
private:
|
||||
point_t _p, _step;
|
||||
@@ -74,8 +92,10 @@ struct const_iterator_type<position_iterator<Deref,Dim> > {
|
||||
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>
|
||||
{
|
||||
};
|
||||
|
||||
/////////////////////////////
|
||||
@@ -89,7 +109,7 @@ 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_ {};
|
||||
struct is_planar<position_iterator<Deref, Dim>> : std::false_type {};
|
||||
|
||||
template <typename Deref,int Dim>
|
||||
struct channel_type<position_iterator<Deref,Dim> > : public channel_type<typename Deref::value_type> {};
|
||||
|
||||
Reference in New Issue
Block a user