diff --git a/include/boost/gil/extension/dynamic_image/algorithm.hpp b/include/boost/gil/extension/dynamic_image/algorithm.hpp index dd2507e54..ca378840d 100644 --- a/include/boost/gil/extension/dynamic_image/algorithm.hpp +++ b/include/boost/gil/extension/dynamic_image/algorithm.hpp @@ -149,7 +149,7 @@ template struct fill_pixels_fn { fill_pixels_fn(const Value& val) : _val(val) {} - typedef void result_type; + using result_type = void; template result_type operator()(const V& img_view) const { fill_pixels_fn1::value>::apply(img_view,_val); } diff --git a/include/boost/gil/extension/dynamic_image/any_image.hpp b/include/boost/gil/extension/dynamic_image/any_image.hpp index 66d0e47fc..96b2a259b 100644 --- a/include/boost/gil/extension/dynamic_image/any_image.hpp +++ b/include/boost/gil/extension/dynamic_image/any_image.hpp @@ -22,15 +22,15 @@ namespace boost { namespace gil { namespace detail { - template struct get_view_t { typedef typename T::view_t type; }; + template struct get_view_t { using type = typename T::view_t; }; template struct images_get_views_t : public mpl::transform > {}; - template struct get_const_view_t { typedef typename T::const_view_t type; }; + template struct get_const_view_t { using type = typename T::const_view_t; }; template struct images_get_const_views_t : public mpl::transform > {}; struct recreate_image_fnobj { - typedef void result_type; + using result_type = void; point const& _dimensions; unsigned _alignment; @@ -41,13 +41,13 @@ namespace detail { template // Models AnyViewConcept struct any_image_get_view { - typedef AnyView result_type; + using result_type = AnyView; template result_type operator()( Image& img) const { return result_type(view(img)); } }; template // Models AnyConstViewConcept struct any_image_get_const_view { - typedef AnyConstView result_type; + using result_type = AnyConstView; template result_type operator()(const Image& img) const { return result_type(const_view(img)); } }; } @@ -58,19 +58,19 @@ namespace detail { /// /// Represents an image whose type (color space, layout, planar/interleaved organization, etc) can be specified at run time. /// It is the runtime equivalent of \p image. -/// Some of the requirements of ImageConcept, such as the \p value_type typedef cannot be fulfilled, since the language does not allow runtime type specification. +/// Some of the requirements of ImageConcept, such as the \p value_type alias cannot be fulfilled, since the language does not allow runtime type specification. /// Other requirements, such as access to the pixels, would be inefficient to provide. Thus \p any_image does not fully model ImageConcept. /// In particular, its \p view and \p const_view methods return \p any_image_view, which does not fully model ImageViewConcept. See \p any_image_view for more. //////////////////////////////////////////////////////////////////////////////////////// template class any_image : public variant { - typedef variant parent_t; + using parent_t = variant; public: - typedef any_image_view::type> const_view_t; - typedef any_image_view::type> view_t; - typedef std::ptrdiff_t x_coord_t; - typedef std::ptrdiff_t y_coord_t; - typedef point point_t; + using const_view_t = any_image_view::type>; + using view_t = any_image_view::type>; + using x_coord_t = std::ptrdiff_t; + using y_coord_t = std::ptrdiff_t; + using point_t = point; any_image() : parent_t() {} template explicit any_image(const T& obj) : parent_t(obj) {} diff --git a/include/boost/gil/extension/dynamic_image/any_image_view.hpp b/include/boost/gil/extension/dynamic_image/any_image_view.hpp index 7c9bfa08b..4c68ba7e3 100644 --- a/include/boost/gil/extension/dynamic_image/any_image_view.hpp +++ b/include/boost/gil/extension/dynamic_image/any_image_view.hpp @@ -17,7 +17,7 @@ namespace boost { namespace gil { namespace detail { - template struct get_const_t { typedef typename View::const_t type; }; + template struct get_const_t { using type = typename View::const_t; }; template struct views_get_const_t : public mpl::transform > {}; } template struct dynamic_xy_step_type; @@ -28,7 +28,7 @@ namespace detail { // works for both image_view and image struct any_type_get_num_channels { - typedef int result_type; + using result_type = int; template result_type operator()(const T&) const { return num_channels::value; } }; @@ -50,7 +50,7 @@ namespace detail { /// /// Represents a view whose type (color space, layout, planar/interleaved organization, etc) can be specified at run time. /// It is the runtime equivalent of \p image_view. -/// Some of the requirements of ImageViewConcept, such as the \p value_type typedef cannot be fulfilled, since the language does not allow runtime type specification. +/// Some of the requirements of ImageViewConcept, such as the \p value_type alias cannot be fulfilled, since the language does not allow runtime type specification. /// Other requirements, such as access to the pixels, would be inefficient to provide. Thus \p any_image_view does not fully model ImageViewConcept. /// However, many algorithms provide overloads taking runtime specified views and thus in many cases \p any_image_view can be used in places taking a view. /// @@ -58,12 +58,12 @@ namespace detail { //////////////////////////////////////////////////////////////////////////////////////// template class any_image_view : public variant { - typedef variant parent_t; + using parent_t = variant; public: - typedef any_image_view::type> const_t; - typedef std::ptrdiff_t x_coord_t; - typedef std::ptrdiff_t y_coord_t; - typedef point point_t; + using const_t = any_image_view::type>; + using x_coord_t = std::ptrdiff_t; + using y_coord_t = std::ptrdiff_t; + using point_t = point; any_image_view() : parent_t() {} template explicit any_image_view(const T& obj) : parent_t(obj) {} @@ -85,8 +85,9 @@ public: ///////////////////////////// template -struct dynamic_x_step_type > { - typedef any_image_view >::type> type; +struct dynamic_x_step_type> +{ + using type = any_image_view>::type>; }; ///////////////////////////// @@ -94,18 +95,21 @@ struct dynamic_x_step_type > { ///////////////////////////// template -struct dynamic_y_step_type > { - typedef any_image_view >::type> type; +struct dynamic_y_step_type> +{ + using type = any_image_view>::type>; }; template -struct dynamic_xy_step_type > { - typedef any_image_view >::type> type; +struct dynamic_xy_step_type> +{ + using type = any_image_view>::type>; }; template -struct dynamic_xy_step_transposed_type > { - typedef any_image_view >::type> type; +struct dynamic_xy_step_transposed_type> +{ + using type = any_image_view>::type>; }; }} // namespace boost::gil diff --git a/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp b/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp index 7869c7c73..82d58b1f1 100644 --- a/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp +++ b/include/boost/gil/extension/dynamic_image/apply_operation_base.hpp @@ -29,9 +29,9 @@ GENERATE_APPLY_FWD_OPS generates for every N functions that look like this (for template <> struct apply_operation_fwd_fn<3> { template typename UnaryOp::result_type apply(Bits& bits, std::size_t index, UnaryOp op) const { - typedef typename mpl::begin::type T0; - typedef typename mpl::next::type T1; - typedef typename mpl::next::type T2; + using T0 = typename mpl::begin::type; + using T1 = typename mpl::next::type; + using T2 = typename mpl::next::type; switch (index) { case 0: return op(reinterpret_cast::type&>(bits)); case 1: return op(reinterpret_cast::type&>(bits)); @@ -42,9 +42,9 @@ GENERATE_APPLY_FWD_OPS generates for every N functions that look like this (for template typename UnaryOp::result_type applyc(const Bits& bits, std::size_t index, UnaryOp op) const { - typedef typename mpl::begin::type T0; - typedef typename mpl::next::type T1; - typedef typename mpl::next::type T2; + using T0 = typename mpl::begin::type; + using T1 = typename mpl::next::type; + using T2 = typename mpl::next::type; switch (index) { case 0: return op(reinterpret_cast::type&>(bits)); case 1: return op(reinterpret_cast::type&>(bits)); @@ -55,6 +55,7 @@ GENERATE_APPLY_FWD_OPS generates for every N functions that look like this (for }; */ +// TODO: Review, simplify, refactor, modernize (e.g. typedef to using) --mloskot #define GIL_FWD_TYPEDEFS(z, N, text) T##N; typedef typename mpl::next::type #define GIL_FWD_CASE(z, N, SUM) case N: return op(*gil_reinterpret_cast::type*>(&bits)); #define GIL_FWD_CONST_CASE(z, N, SUM) case N: return op(*gil_reinterpret_cast_c::type*>(&bits)); @@ -133,7 +134,7 @@ namespace detail { const T2& _t2; Op& _op; - typedef typename Op::result_type result_type; + using result_type = typename Op::result_type; reduce_bind1(const T2& t2, Op& op) : _t2(t2), _op(op) {} @@ -146,7 +147,7 @@ namespace detail { std::size_t _index1; Op& _op; - typedef typename Op::result_type result_type; + using result_type = typename Op::result_type; reduce_bind2(const Bits1& bits1, std::size_t index1, Op& op) : _bits1(bits1), _index1(index1), _op(op) {} diff --git a/include/boost/gil/extension/dynamic_image/image_view_factory.hpp b/include/boost/gil/extension/dynamic_image/image_view_factory.hpp index f46e24a2b..a8686ed3f 100644 --- a/include/boost/gil/extension/dynamic_image/image_view_factory.hpp +++ b/include/boost/gil/extension/dynamic_image/image_view_factory.hpp @@ -20,34 +20,34 @@ namespace boost { namespace gil { namespace detail { template struct flipped_up_down_view_fn { - typedef Result result_type; + using result_type = Result; template result_type operator()(const View& src) const { return result_type(flipped_up_down_view(src)); } }; template struct flipped_left_right_view_fn { - typedef Result result_type; + using result_type = Result; template result_type operator()(const View& src) const { return result_type(flipped_left_right_view(src)); } }; template struct rotated90cw_view_fn { - typedef Result result_type; + using result_type = Result; template result_type operator()(const View& src) const { return result_type(rotated90cw_view(src)); } }; template struct rotated90ccw_view_fn { - typedef Result result_type; + using result_type = Result; template result_type operator()(const View& src) const { return result_type(rotated90ccw_view(src)); } }; template struct tranposed_view_fn { - typedef Result result_type; + using result_type = Result; template result_type operator()(const View& src) const { return result_type(tranposed_view(src)); } }; template struct rotated180_view_fn { - typedef Result result_type; + using result_type = Result; template result_type operator()(const View& src) const { return result_type(rotated180_view(src)); } }; template struct subimage_view_fn { - typedef Result result_type; + using result_type = Result; subimage_view_fn(point_t const& topleft, point_t const& dimensions) : _topleft(topleft), _size2(dimensions) {} @@ -65,7 +65,7 @@ struct subimage_view_fn template struct subsampled_view_fn { - typedef Result result_type; + using result_type = Result; subsampled_view_fn(point_t const& step) : _step(step) {} template @@ -78,13 +78,13 @@ struct subsampled_view_fn }; template struct nth_channel_view_fn { - typedef Result result_type; + using result_type = Result; nth_channel_view_fn(int n) : _n(n) {} int _n; template result_type operator()(const View& src) const { return result_type(nth_channel_view(src,_n)); } }; template struct color_converted_view_fn { - typedef Result result_type; + using result_type = Result; color_converted_view_fn(CC cc = CC()): _cc(cc) {} template result_type operator()(const View& src) const { return result_type(color_converted_view(src, _cc)); } @@ -180,7 +180,7 @@ inline auto subsampled_view(any_image_view const& src, int xStep, int } namespace detail { - template struct get_nthchannel_type { typedef typename nth_channel_view_type::type type; }; + template struct get_nthchannel_type { using type = typename nth_channel_view_type::type; }; template struct views_get_nthchannel_type : public mpl::transform > {}; } @@ -188,7 +188,7 @@ namespace detail { /// \brief Given a runtime source image view, returns the type of a runtime image view over a single channel of the source view template struct nth_channel_view_type > { - typedef any_image_view::type> type; + using type = any_image_view::type>; }; /// \ingroup ImageViewTransformationsNthChannel @@ -205,8 +205,9 @@ namespace detail { /// \ingroup ImageViewTransformationsColorConvert /// \brief Returns the type of a runtime-specified view, color-converted to a given pixel type with user specified color converter template -struct color_converted_view_type,DstP,CC> { - typedef any_image_view::type> type; +struct color_converted_view_type,DstP,CC> +{ + using type = any_image_view::type>; }; /// \ingroup ImageViewTransformationsColorConvert @@ -219,8 +220,9 @@ typename color_converted_view_type, DstP, CC>::type co /// \ingroup ImageViewTransformationsColorConvert /// \brief Returns the type of a runtime-specified view, color-converted to a given pixel type with the default coor converter template -struct color_converted_view_type,DstP> { - typedef any_image_view::type> type; +struct color_converted_view_type,DstP> +{ + using type = any_image_view::type>; }; /// \ingroup ImageViewTransformationsColorConvert diff --git a/include/boost/gil/extension/dynamic_image/reduce.hpp b/include/boost/gil/extension/dynamic_image/reduce.hpp index 2ab258901..699acb5e6 100644 --- a/include/boost/gil/extension/dynamic_image/reduce.hpp +++ b/include/boost/gil/extension/dynamic_image/reduce.hpp @@ -49,14 +49,16 @@ template struct mapping_vector {}; template -struct at_c, K> { +struct at_c, K> +{ static const std::size_t value=size::value - order::type>::type::value +1; - typedef size_t type; + using type = size_t; }; template -struct size > { - typedef typename size::type type; +struct size> +{ + using type = typename size::type; static const std::size_t value=type::value; }; @@ -65,7 +67,7 @@ struct size > { /// /// Temporary solution because I couldn't get mpl::copy to do this. /// This is what I tried: -/// mpl::copy > >::type; +/// mpl::copy>>::type; /// It works when SET is mpl::vector, but not when SET is mpl::set... /////////////////////////////////////////////////////// @@ -73,27 +75,30 @@ namespace detail { template struct copy_to_vector_impl { private: - typedef typename deref::type T; - typedef typename next::type next; - typedef typename copy_to_vector_impl::type rest; + using T = typename deref::type; + using next = typename next::type; + using rest = typename copy_to_vector_impl::type; public: - typedef typename push_front::type type; + using type = typename push_front::type; }; template - struct copy_to_vector_impl { - typedef vector::type> type; + struct copy_to_vector_impl + { + using type = vector::type>; }; } template -struct copy_to_vector { - typedef typename detail::copy_to_vector_impl::type, size::value>::type type; +struct copy_to_vector +{ + using type = typename detail::copy_to_vector_impl::type, size::value>::type; }; template <> -struct copy_to_vector > { - typedef vector0<> type; +struct copy_to_vector> +{ + using type = vector0<>; }; } } // boost::mpl @@ -124,18 +129,20 @@ namespace boost { namespace gil { template struct unary_reduce_impl { - typedef typename mpl::transform >::type reduced_t; - typedef typename mpl::copy, mpl::insert > >::type unique_t; + using reduced_t = typename mpl::transform >::type; + using unique_t = typename mpl::copy, mpl::insert>>::type; static const bool is_single=mpl::size::value==1; }; template ::is_single> -struct unary_reduce : public unary_reduce_impl { - typedef typename unary_reduce_impl::reduced_t reduced_t; - typedef typename unary_reduce_impl::unique_t unique_t; +struct unary_reduce : public unary_reduce_impl +{ + using reduced_t = typename unary_reduce_impl::reduced_t; + using unique_t = typename unary_reduce_impl::unique_t; - static unsigned short inline map_index(std::size_t index) { - typedef typename mpl::mapping_vector indices_t; + static unsigned short inline map_index(std::size_t index) + { + using indices_t = typename mpl::mapping_vector; return gil::at_c(index); } template BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) { @@ -149,7 +156,7 @@ struct unary_reduce : public unary_reduce_impl { template struct unary_reduce : public unary_reduce_impl { - typedef typename unary_reduce_impl::unique_t unique_t; + using unique_t = typename unary_reduce_impl::unique_t; static unsigned short inline map_index(std::size_t index) { return 0; } template BOOST_FORCEINLINE static typename Op::result_type applyc(const Bits& bits, std::size_t index, Op op) { @@ -177,20 +184,22 @@ struct unary_reduce : public unary_reduce_impl { namespace detail { struct pair_generator { - template struct apply { - typedef std::pair::type*, const typename mpl::at_c::type*> type; + template struct apply + { + using type = std::pair::type*, const typename mpl::at_c::type*>; }; }; // When the types are not too large, applies reduce on their cross product template - struct binary_reduce_impl { + struct binary_reduce_impl + { //private: - typedef typename mpl::copy_to_vector::type vec1_types; - typedef typename mpl::copy_to_vector::type vec2_types; + using vec1_types = typename mpl::copy_to_vector::type; + using vec2_types = typename mpl::copy_to_vector::type; - typedef mpl::cross_vector, pair_generator> BIN_TYPES; - typedef unary_reduce bin_reduced_t; + using BIN_TYPES = mpl::cross_vector, pair_generator>; + using bin_reduced_t = unary_reduce; static unsigned short inline map_index(std::size_t index1, std::size_t index2) { unsigned short r1=Unary1::map_index(index1); @@ -198,7 +207,7 @@ namespace detail { return bin_reduced_t::map_index(r2*mpl::size::value + r1); } public: - typedef typename bin_reduced_t::unique_t unique_t; + using unique_t = typename bin_reduced_t::unique_t template static typename Op::result_type inline apply(const Bits1& bits1, std::size_t index1, const Bits2& bits2, std::size_t index2, Op op) { @@ -219,15 +228,16 @@ namespace detail { template -struct binary_reduce { +struct binary_reduce +{ //private: - typedef unary_reduce unary1_t; - typedef unary_reduce unary2_t; + using unary1_t = unary_reduce; + using unary2_t = unary_reduce; static const std::size_t CROSS_SIZE = mpl::size::value * mpl::size::value; - typedef detail::binary_reduce_implGIL_BINARY_REDUCE_LIMIT)> impl; + using impl = detail::binary_reduce_implGIL_BINARY_REDUCE_LIMIT)>; public: template static typename Op::result_type inline apply(const Bits1& bits1, std::size_t index1, const Bits2& bits2, std::size_t index2, Op op) { @@ -281,8 +291,9 @@ struct cross_vector {}; /// \brief Iterator of cross_vector /// \ingroup CrossVectorIterator template -struct cross_iterator { - typedef mpl::random_access_iterator_tag category; +struct cross_iterator +{ + using category = mpl::random_access_iterator_tag; }; /////////////////////////////////////////////////////// @@ -295,40 +306,45 @@ struct cross_iterator { /// to represent the iterator's position K as a vector of indices. Extracts the corresponding type of /// each input vector and passes the element types to the type generation function, which returns the dereferenced type template -struct deref > { +struct deref> +{ private: - typedef typename detail::select_subvector_c::type DerefTypes; + using DerefTypes = typename detail::select_subvector_c::type; public: - typedef typename TypeGen::template apply::type type; + using type = typename TypeGen::template apply::type; }; /// \brief Increments a cross-vector iterator. /// \ingroup CrossVectorIterator template -struct next > { - typedef cross_iterator type; +struct next> +{ + using type = cross_iterator; }; /// \brief Decrements a cross-vector iterator. /// \ingroup CrossVectorIterator template -struct prior > { - typedef cross_iterator type; +struct prior> +{ + using type = cross_iterator; }; /// \brief Advances a cross-vector iterator. /// \ingroup CrossVectorIterator template -struct advance, Distance > { - typedef cross_iterator type; +struct advance, Distance> +{ + using type = cross_iterator; }; /// \brief Computes the distance between two cross-vector iterator-s. /// \ingroup CrossVectorIterator // (shortened the names of the template arguments - otherwise doxygen cannot parse this...) template -struct distance, cross_iterator > { - typedef size_t type; +struct distance, cross_iterator> +{ + using type = size_t; }; /////////////////////////////////////////////////////// @@ -337,80 +353,88 @@ struct distance, cross_iterator -struct size > { - typedef typename fold, times<_1, size<_2> > >::type type; +struct size> +{ + using type = typename fold, times<_1, size<_2>>>::type; static const std::size_t value=type::value; }; /// \brief Determines whether a cross vector is empty /// \ingroup CrossVector template -struct empty > { - typedef typename empty::type type; +struct empty> { + using type = typename empty::type; }; /// \brief Returns the K-th element of a cross vector /// \ingroup CrossVector template -struct at, K> { +struct at, K> +{ private: - typedef cross_iterator KthIterator; + using KthIterator = cross_iterator; public: - typedef typename deref::type type; + using type = typename deref::type; }; /// \brief Returns an iterator to the first element of a cross vector /// \ingroup CrossVector template -struct begin > { - typedef cross_iterator type; +struct begin> +{ + using type = cross_iterator; }; /// \brief Returns an iterator to the last element of a cross vector /// \ingroup CrossVector template -struct end > { +struct end> +{ private: - typedef cross_vector this_t; + using this_t = cross_vector; public: - typedef cross_iterator::value> type; + using type = cross_iterator::value>; }; /// \brief Returns the first element of a cross vector /// \ingroup CrossVector template -struct front > { +struct front> { private: - typedef cross_vector this_t; + using this_t = cross_vector; public: - typedef typename deref::type>::type type; + using type = typename deref::type>::type; }; /// \brief Returns the last element of a cross vector /// \ingroup CrossVector template -struct back > { +struct back> +{ private: - typedef cross_vector this_t; - typedef typename size::type size; - typedef typename minus >::type last_index; + using this_t = cross_vector; + using size = typename size::type; + using last_index = typename minus>::type; public: - typedef typename at::type type; + using type = typename at::type; }; /// \brief Transforms the elements of a cross vector /// \ingroup CrossVector template -struct transform, OPP > { - typedef typename lambda::type Op; - struct adapter { +struct transform, OPP> +{ + using Op = typename lambda::type; + struct adapter + { template - struct apply { - typedef typename TypeGen::template apply::type orig_t; - typedef typename Op::template apply::type type; + struct apply + { + using orig_t = typename TypeGen::template apply::type; + using type = typename Op::template apply::type; }; }; - typedef cross_vector type; + using type = cross_vector; }; } } // boost::mpl @@ -434,8 +458,9 @@ namespace detail { //// //////////////////////////////////////////////////////// template - struct reduce { - typedef T type; + struct reduce + { + using type = T; }; //////////////////////////////////////////////////////// @@ -446,13 +471,14 @@ namespace detail { //////////////////////////////////////////////////////// template - struct reduce_view_basic { - typedef View type; + struct reduce_view_basic + { + using type = View; }; template - struct reduce > - : public reduce_view_basic,view_is_basic >::value> {}; + struct reduce> + : public reduce_view_basic,view_is_basic>::value> {}; //////////////////////////////////////////////////////// //// @@ -462,12 +488,13 @@ namespace detail { //////////////////////////////////////////////////////// template - struct reduce_image_basic { - typedef Img type; + struct reduce_image_basic + { + using type = Img; }; template - struct reduce > : public reduce_image_basic,image_is_basic >::value > {}; + struct reduce> : public reduce_image_basic,image_is_basic>::value > {}; //////////////////////////////////////////////////////// //// @@ -477,14 +504,15 @@ namespace detail { //////////////////////////////////////////////////////// template - struct reduce_views_basic { - typedef std::pair type; + struct reduce_views_basic + { + using type = std::pair; }; template - struct reduce*, const image_view*> > + struct reduce*, const image_view*>> : public reduce_views_basic,image_view, - mpl::and_ >, view_is_basic > >::value > + mpl::and_>, view_is_basic>>::value > {}; @@ -494,14 +522,15 @@ namespace detail { //// //////////////////////////////////////////////////////// - template - struct reduce_color_space { - typedef Cs type; + template + struct reduce_color_space + { + using type = CS; }; - template <> struct reduce_color_space { typedef rgb_t type; }; - template <> struct reduce_color_space { typedef rgb_t type; }; - template <> struct reduce_color_space { typedef rgba_t type; }; + template <> struct reduce_color_space { using type = rgb_t; }; + template <> struct reduce_color_space { using type = rgb_t; }; + template <> struct reduce_color_space { using type = rgba_t; }; /* //////////////////////////////////////////////////////// @@ -514,8 +543,8 @@ namespace detail { template struct type_vec_to_integer_impl { - typedef typename mpl::back::type last; - typedef typename mpl::pop_back::type rest; + using last = typename mpl::back::type; + using rest = typename mpl::pop_back::type; static const int value = type_vec_to_integer_impl::value * Basis + last::value; }; @@ -533,86 +562,87 @@ namespace detail { // The default version performs no reduction template struct reduce_color_spaces_impl { - typedef SrcColorSpace first_t; - typedef DstColorSpace second_t; + using first_t = SrcColorSpace; + using second_t = DstColorSpace; }; // 012: RGB-RGB, bgr-bgr, lab-lab, hsb-hsb template struct reduce_color_spaces_impl { - typedef rgb_t first_t; - typedef rgb_t second_t; + using first_t = rgb_t; + using second_t = rgb_t; }; // 210: RGB-bgr, bgr-RGB template struct reduce_color_spaces_impl { - typedef rgb_t first_t; - typedef bgr_t second_t; + using first_t = rgb_t; + using second_t = bgr_t; }; // 0123: RGBA-RGBA, bgra-bgra, argb-argb, abgr-abgr cmyk-cmyk template struct reduce_color_spaces_impl { - typedef rgba_t first_t; - typedef rgba_t second_t; + using first_t = rgba_t; + using second_t = rgba_t; }; // 3210: RGBA-abgr, bgra-argb, argb-bgra, abgr-RGBA template struct reduce_color_spaces_impl { - typedef rgba_t first_t; - typedef abgr_t second_t; + using first_t = rgba_t; + using second_t = abgr_t; }; // 1230: RGBA-argb, bgra-abgr template struct reduce_color_spaces_impl { - typedef rgba_t first_t; - typedef argb_t second_t; + using first_t = rgba_t; + using second_t = argb_t; }; // 2103: RGBA-bgra, bgra-RGBA (uses subclass to ensure that base color space is not reduced to derived) template struct reduce_color_spaces_impl { - typedef rgba_t first_t; - typedef bgra_t second_t; + using first_t = rgba_t; + using second_t = bgra_t; }; // 3012: argb-RGBA, abgr-bgra template struct reduce_color_spaces_impl { - typedef argb_t first_t; - typedef rgba_t second_t; + using first_t = argb_t; + using second_t = rgba_t; }; // 0321: argb-abgr, abgr-argb template struct reduce_color_spaces_impl { - typedef argb_t first_t; - typedef abgr_t second_t; + using first_t = argb_t; + using second_t = abgr_t; }; template struct reduce_color_spaces { - typedef typename channel_order::type src_order_t; - typedef typename channel_order::type dst_order_t; - typedef typename mpl::transform >::type mapping; + using src_order_t = typename channel_order::type; + using dst_order_t = typename channel_order::type; + using mapping = typename mpl::transform>::type; static const int mapping_val = type_vec_to_integer::value; - typedef typename reduce_color_spaces_impl::first_t _first_t; - typedef typename reduce_color_spaces_impl::second_t _second_t; - typedef typename mpl::and_, mpl::not_< color_space_is_base<_second_t> > > swap_t; + using _first_t = typename reduce_color_spaces_impl::first_t; + using _second_t = typename reduce_color_spaces_impl::second_t; + using swap_t = typename mpl::and_, mpl::not_< color_space_is_base<_second_t>>>; public: - typedef typename mpl::if_::type first_t; - typedef typename mpl::if_::type second_t; + using first_t = typename mpl::if_::type; + using second_t = typename mpl::if_::type; }; */ // TODO: Use the old code for reduce_color_spaces above to do color layout reduction template - struct reduce_color_layouts { - typedef SrcLayout first_t; - typedef DstLayout second_t; + struct reduce_color_layouts + { + using first_t = SrcLayout; + using second_t = DstLayout; }; //////////////////////////////////////////////////////// @@ -628,38 +658,40 @@ namespace detail { template struct reduce_view_basic { private: - typedef typename reduce_color_space::type Cs; // reduce the color space - typedef layout layout_t; + using color_space_t = typename reduce_color_space::type color_space_t; // reduce the color space + using layout_t = layout; public: - typedef typename derived_view_type::type type; + using type = typename derived_view_type::type; }; */ // Incompatible views cannot be used in copy_pixels - will throw std::bad_cast template - struct reduce_copy_pixop_compat { - typedef error_t type; + struct reduce_copy_pixop_compat + { + using type = error_t; }; // For compatible basic views, reduce their color spaces based on their channel mapping. // Make the source immutable and the destination mutable (they should already be that way) template - struct reduce_copy_pixop_compat { - typedef layout layout1; - typedef layout layout2; + struct reduce_copy_pixop_compat + { + using layout1 = layout; + using layout2 = layout; - typedef typename reduce_color_layouts::first_t L1; - typedef typename reduce_color_layouts::second_t L2; + using L1 = typename reduce_color_layouts::first_t; + using L2 = typename reduce_color_layouts::second_t; - typedef typename derived_view_type::type DV1; - typedef typename derived_view_type::type DV2; + using DV1 = typename derived_view_type::type; + using DV2 = typename derived_view_type::type; - typedef std::pair type; + using type = std::pair; }; // The general 2D version branches into compatible and incompatible views template struct reduce_views_basic - : public reduce_copy_pixop_compat, view_is_mutable >::value > { + : public reduce_copy_pixop_compat, view_is_mutable>::value > { }; //////////////////////////////////////////////////////// @@ -669,7 +701,11 @@ namespace detail { //////////////////////////////////////////////////////// struct destructor_op; - template struct reduce_view_basic { typedef gray8_view_t type; }; + template + struct reduce_view_basic + { + using type = gray8_view_t; + }; //////////////////////////////////////////////////////// //// @@ -678,8 +714,18 @@ namespace detail { //////////////////////////////////////////////////////// struct any_type_get_dimensions; - template struct reduce_view_basic { typedef gray8_view_t type; }; - template struct reduce_image_basic { typedef gray8_image_t type; }; + + template + struct reduce_view_basic + { + using type = gray8_view_t; + }; + + template + struct reduce_image_basic + { + using type = gray8_image_t; + }; //////////////////////////////////////////////////////// //// @@ -688,13 +734,19 @@ namespace detail { //////////////////////////////////////////////////////// struct any_type_get_num_channels; - template struct reduce_view_basic { - typedef typename View::color_space_t::base Cs; - typedef typename view_type::type>::type type; + + template + struct reduce_view_basic + { + using color_space_t = typename View::color_space_t::base; + using type = typename view_type::type>::type; }; - template struct reduce_image_basic { - typedef typename Img::color_space_t::base Cs; - typedef typename image_type::type>::type type; + + template + struct reduce_image_basic + { + using color_space_t = typename Img::color_space_t::base; + using type = typename image_type::type>::type; }; //////////////////////////////////////////////////////// @@ -730,17 +782,18 @@ namespace detail { // For 2D reduce, if they have the same channels and color spaces (i.e. the same pixels) then copy_and_convert is just copy. // In this case, reduce their common color space. In general make the first immutable and the second mutable template - struct reduce_views_basic, V1, V2, AreBasic> { - typedef is_same Same; + struct reduce_views_basic, V1, V2, AreBasic> + { + using Same = is_same; - typedef reduce_color_space CsR; - typedef typename mpl::if_::type Cs1; - typedef typename mpl::if_::type Cs2; + using CsR = reduce_color_space; + using Cs1 = typename mpl::if_::type; + using Cs2 = typename mpl::if_::type; - typedef typename derived_view_type, use_default, use_default, mpl::false_>::type DV1; - typedef typename derived_view_type, use_default, use_default, mpl::true_ >::type DV2; + using DV1 = typename derived_view_type, use_default, use_default, mpl::false_>::type; + using DV2 = typename derived_view_type, use_default, use_default, mpl::true_ >::type; - typedef std::pair type; + using type = std::pair; }; @@ -760,15 +813,15 @@ namespace detail { //detail::any_image_get_view::view_t> //detail::any_image_get_const_view::view_t> - //detail::flipped_up_down_view_fn > + //detail::flipped_up_down_view_fn> //detail::flipped_left_right_view_fn::dynamic_step_t> //detail::tranposed_view_fn::dynamic_step_t> //detail::rotated90cw_view_fn::dynamic_step_t> //detail::rotated90ccw_view_fn::dynamic_step_t> //detail::rotated180_view_fn::dynamic_step_t> - //detail::subimage_view_fn > + //detail::subimage_view_fn> //detail::subsampled_view_fn::dynamic_step_t> - //detail::nth_channel_view_fn > + //detail::nth_channel_view_fn> //detail::color_converted_view_fn, DstP>::type > } diff --git a/include/boost/gil/extension/dynamic_image/variant.hpp b/include/boost/gil/extension/dynamic_image/variant.hpp index a0eb0f85d..ecd817aef 100644 --- a/include/boost/gil/extension/dynamic_image/variant.hpp +++ b/include/boost/gil/extension/dynamic_image/variant.hpp @@ -35,7 +35,7 @@ namespace detail { template struct type_to_index; template struct reduce; struct destructor_op { - typedef void result_type; + using result_type = void; template result_type operator()(const T& t) const { t.~T(); } }; template void copy_construct_in_place(const T& t, Bits& bits); @@ -82,9 +82,9 @@ class variant { static const std::size_t MAX_SIZE = mpl::fold, mpl::max > >::type::value; static const std::size_t NUM_TYPES = mpl::size::value; public: - typedef Types types_t; + using types_t = Types; - typedef struct { char data[MAX_SIZE]; } base_t; // empty space equal to the size of the largest type in Types + using base_t = struct { char data[MAX_SIZE]; }; // empty space equal to the size of the largest type in Types // Default constructor - default construct the first type variant() : _index(0) { new(&_bits) typename mpl::at_c::type(); } @@ -142,7 +142,7 @@ namespace detail { template struct copy_construct_in_place_fn { - typedef void result_type; + using result_type = void; Bits& _dst; copy_construct_in_place_fn(Bits& dst) : _dst(dst) {} @@ -154,7 +154,7 @@ namespace detail { const Bits& _dst; equal_to_fn(const Bits& dst) : _dst(dst) {} - typedef bool result_type; + using result_type = bool; template result_type operator()(const T& x) const { return x==*gil_reinterpret_cast_c(&_dst); } @@ -162,7 +162,7 @@ namespace detail { template struct type_to_index_fn { - typedef std::size_t result_type; + using result_type = std::size_t; template result_type operator()(const T&) const { return detail::type_to_index::value; } };