Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / gil / pixel_iterator.hpp
index 837c9df..a359680 100644 (file)
@@ -14,6 +14,7 @@
 #include <boost/gil/pixel.hpp>
 
 #include <iterator>
+#include <type_traits>
 
 namespace boost { namespace gil {
 
@@ -24,7 +25,7 @@ class memory_based_step_iterator;
 /// \brief metafunction predicate determining whether the given iterator is a plain one or an adaptor over another iterator.
 /// Examples of adaptors are the step iterator and the dereference iterator adaptor.
 template <typename It>
-struct is_iterator_adaptor : public mpl::false_{};
+struct is_iterator_adaptor : public std::false_type {};
 
 /// \brief returns the base iterator for a given iterator adaptor. Provide an specialization when introducing new iterator adaptors
 template <typename It>
@@ -48,8 +49,11 @@ template <typename It>
 struct iterator_is_mutable{};
 
 // The default implementation when the iterator is a C pointer is to use the standard constness semantics
-template <typename T> struct iterator_is_mutable<      T*> : public mpl::true_{};
-template <typename T> struct iterator_is_mutable<const T*> : public mpl::false_{};
+template <typename T>
+struct iterator_is_mutable<T*> : std::true_type {};
+
+template <typename T>
+struct iterator_is_mutable<T const*> : std::false_type {};
 
 /// \defgroup PixelIteratorModelInterleavedPtr C pointer to a pixel
 /// \ingroup PixelIteratorModel
@@ -79,27 +83,37 @@ struct dynamic_x_step_type<const Pixel*> {
 //  PixelBasedConcept
 /////////////////////////////
 
-template <typename Pixel> struct color_space_type<      Pixel*> : public color_space_type<Pixel> {};
-template <typename Pixel> struct color_space_type<const Pixel*> : public color_space_type<Pixel> {};
+template <typename Pixel>
+struct color_space_type<Pixel*> : color_space_type<Pixel> {};
+
+template <typename Pixel>
+struct color_space_type<Pixel const*> : color_space_type<Pixel> {};
 
-template <typename Pixel> struct channel_mapping_type<      Pixel*> : public channel_mapping_type<Pixel> {};
-template <typename Pixel> struct channel_mapping_type<const Pixel*> : public channel_mapping_type<Pixel> {};
+template <typename Pixel>
+struct channel_mapping_type<Pixel*> : channel_mapping_type<Pixel> {};
 
-template <typename Pixel> struct is_planar<      Pixel*> : public is_planar<Pixel> {};
-template <typename Pixel> struct is_planar<const Pixel*> : public is_planar<Pixel> {};
+template <typename Pixel>
+struct channel_mapping_type<Pixel const*> : channel_mapping_type<Pixel> {};
+
+template <typename Pixel>
+struct is_planar<Pixel*> : is_planar<Pixel> {};
+
+template <typename Pixel>
+struct is_planar<Pixel const*> : is_planar<Pixel> {};
 
 /////////////////////////////
 //  HomogeneousPixelBasedConcept
 /////////////////////////////
 
-template <typename Pixel> struct channel_type<Pixel*> : public channel_type<Pixel> {};
-template <typename Pixel> struct channel_type<const Pixel*> : public channel_type<Pixel> {};
+template <typename Pixel>
+struct channel_type<Pixel*> : channel_type<Pixel> {};
+
+template <typename Pixel>
+struct channel_type<Pixel const*> : channel_type<Pixel> {};
 
 ////////////////////////////////////////////////////////////////////////////////////////
-///
-/// Support for pixel iterator movement measured in memory units (bytes or bits) as opposed to pixel type. \n
+/// Support for pixel iterator movement measured in memory units (bytes or bits) as opposed to pixel type.
 /// Necessary to handle image row alignment and channel plane alignment.
-///
 ////////////////////////////////////////////////////////////////////////////////////////
 
 /////////////////////////////
@@ -107,23 +121,28 @@ template <typename Pixel> struct channel_type<const Pixel*> : public channel_typ
 /////////////////////////////
 
 template <typename T>
-struct byte_to_memunit : public mpl::int_<1> {};
+struct byte_to_memunit : std::integral_constant<int, 1> {};
 
 template <typename P>
-inline std::ptrdiff_t memunit_step(const P*) { return sizeof(P); }
+inline std::ptrdiff_t memunit_step(P const*) { return sizeof(P); }
 
 template <typename P>
-inline std::ptrdiff_t memunit_distance(const P* p1, const P* p2) {
-    return (gil_reinterpret_cast_c<const unsigned char*>(p2)-gil_reinterpret_cast_c<const unsigned char*>(p1));
+inline std::ptrdiff_t memunit_distance(P const* p1, P const* p2)
+{
+    return (
+        gil_reinterpret_cast_c<unsigned char const*>(p2) -
+        gil_reinterpret_cast_c<unsigned char const*>(p1));
 }
 
 template <typename P>
-inline void memunit_advance(P* &p, std::ptrdiff_t diff) {
-    p=(P*)((unsigned char*)(p)+diff);
+inline void memunit_advance(P* &p, std::ptrdiff_t diff)
+{
+    p = (P*)((unsigned char*)(p)+diff);
 }
 
 template <typename P>
-inline P* memunit_advanced(const P* p, std::ptrdiff_t diff) {
+inline P* memunit_advanced(const P* p, std::ptrdiff_t diff)
+{
     return (P*)((char*)(p)+diff);
 }