#ifndef id873715F57B504CCF8227CE03EA28CAFA #define id873715F57B504CCF8227CE03EA28CAFA #include "doorkeeper/primitivetypes.hpp" #include "doorkeeper/implem/helpers.hpp" #include "doorkeeper/components/tilecoords.hpp" #include #include #include #include #include #include namespace dk { template class TileIterator; namespace implem { template struct TypeWithQualifiers { typedef typename std::conditional::value && std::is_const::value, typename std::add_cv::type, typename std::conditional::value, typename std::add_volatile::type>::type, typename std::conditional::value, typename std::add_const::type>::type, typename std::remove_cv::type >::type >::type >::type result; }; } //namespace implem template ::type> class TileIterator : public boost::iterator_facade, T, boost::bidirectional_traversal_tag> { friend class boost::iterator_core_access; typedef std::vector vector_type; typedef typename implem::TypeWithQualifiers::result qualif_vector_type; public: typedef TileCoords TileCoordsType; typedef typename TileCoordsType::coords coords; TileIterator ( void ) = default; TileIterator ( const TileIterator& parOther ) = default; TileIterator ( TileIterator&& parOther ) = default; TileIterator ( qualif_vector_type* parData, const coords& parArea ); TileIterator ( qualif_vector_type* parData, const coords& parStart, const coords& parArea ); ~TileIterator ( void ) = default; const TileCoordsType& raw_coords ( void ) const; const coords& position ( void ) const; private: void increment ( void ); void decrement ( void ); void advance ( size_t parAdvance ); ptrdiff_t distance_to ( const TileIterator& parOther ); bool equal ( const TileIterator& parOther ) const; T& dereference ( void ) const; TileCoordsType m_tile_range;; qualif_vector_type* m_data; }; } //namespace dk #include "doorkeeper/implem/tileiterator.inl" #endif