diff --git a/include/boost/gil/color_base_algorithm.hpp b/include/boost/gil/color_base_algorithm.hpp index 6746f83002..233009827b 100644 --- a/include/boost/gil/color_base_algorithm.hpp +++ b/include/boost/gil/color_base_algorithm.hpp @@ -187,14 +187,18 @@ struct color_element_const_reference_type : public kth_semantic_element_const_re /// \brief Mutable accessor to the element associated with a given color name /// \ingroup ColorBaseAlgorithmColor template -typename color_element_reference_type::type get_color(ColorBase& cb, Color=Color()) { +auto get_color(ColorBase& cb, Color=Color()) + -> typename color_element_reference_type::type +{ return color_element_reference_type::get(cb); } /// \brief Constant accessor to the element associated with a given color name /// \ingroup ColorBaseAlgorithmColor template -typename color_element_const_reference_type::type get_color(const ColorBase& cb, Color=Color()) { +auto get_color(const ColorBase& cb, Color=Color()) + -> typename color_element_const_reference_type::type +{ return color_element_const_reference_type::get(cb); } @@ -435,36 +439,63 @@ template<> struct element_recursion<0> { }; // std::min and std::max don't have the mutable overloads... -template inline const Q& mutable_min(const Q& x, const Q& y) { return x inline Q& mutable_min( Q& x, Q& y) { return x inline const Q& mutable_max(const Q& x, const Q& y) { return x inline Q& mutable_max( Q& x, Q& y) { return x +inline auto mutable_min(Q const& x, Q const& y) -> Q const& { return x +inline auto mutable_min(Q& x, Q& y) -> Q& { return x +inline auto mutable_max(Q const& x, Q const& y) -> Q const& { return x +inline auto mutable_max(Q& x, Q& y) -> Q& { return x -struct min_max_recur { - template static typename element_const_reference_type

::type max_(const P& p) { +struct min_max_recur +{ + template + static auto max_(P const& p) -> typename element_const_reference_type

::type + { return mutable_max(min_max_recur::max_(p),semantic_at_c(p)); } - template static typename element_reference_type

::type max_( P& p) { + + template + static auto max_(P& p) -> typename element_reference_type

::type + { return mutable_max(min_max_recur::max_(p),semantic_at_c(p)); } - template static typename element_const_reference_type

::type min_(const P& p) { + + template + static auto min_(P const& p) -> typename element_const_reference_type

::type + { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } - template static typename element_reference_type

::type min_( P& p) { + + template + static auto min_(P& p) -> typename element_reference_type

::type + { return mutable_min(min_max_recur::min_(p),semantic_at_c(p)); } }; // termination condition of the compile-time recursion for min/max element template <> -struct min_max_recur<1> { - template static typename element_const_reference_type

::type max_(const P& p) { return semantic_at_c<0>(p); } - template static typename element_reference_type

::type max_( P& p) { return semantic_at_c<0>(p); } - template static typename element_const_reference_type

::type min_(const P& p) { return semantic_at_c<0>(p); } - template static typename element_reference_type

::type min_( P& p) { return semantic_at_c<0>(p); } +struct min_max_recur<1> +{ + template + static auto max_(P const& p) -> typename element_const_reference_type

::type { return semantic_at_c<0>(p); } + + template + static auto max_(P& p) -> typename element_reference_type

::type { return semantic_at_c<0>(p); } + + template + static auto min_(P const& p) -> typename element_const_reference_type

::type { return semantic_at_c<0>(p); } + + template + static auto min_(P& p) -> typename element_reference_type

::type { return semantic_at_c<0>(p); } }; } // namespace detail @@ -483,19 +514,19 @@ struct min_max_recur<1> { template BOOST_FORCEINLINE -typename element_const_reference_type

::type static_max(const P& p) { return detail::min_max_recur::value>::max_(p); } +auto static_max(P const& p) -> typename element_const_reference_type

::type { return detail::min_max_recur::value>::max_(p); } template BOOST_FORCEINLINE -typename element_reference_type

::type static_max( P& p) { return detail::min_max_recur::value>::max_(p); } +auto static_max(P& p) -> typename element_reference_type

::type { return detail::min_max_recur::value>::max_(p); } template BOOST_FORCEINLINE -typename element_const_reference_type

::type static_min(const P& p) { return detail::min_max_recur::value>::min_(p); } +auto static_min(P const& p) -> typename element_const_reference_type

::type { return detail::min_max_recur::value>::min_(p); } template BOOST_FORCEINLINE -typename element_reference_type

::type static_min( P& p) { return detail::min_max_recur::value>::min_(p); } +auto static_min(P& p) -> typename element_reference_type

::type { return detail::min_max_recur::value>::min_(p); } /// \} /// \defgroup ColorBaseAlgorithmEqual static_equal @@ -515,7 +546,7 @@ typename element_reference_type

::type static_min( P& p) { return d template BOOST_FORCEINLINE -bool static_equal(const P1& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } +bool static_equal(P1 const& p1, const P2& p2) { return detail::element_recursion::value>::static_equal(p1,p2); } /// \} @@ -708,6 +739,6 @@ BOOST_FORCEINLINE Op static_for_each(const P1& p1,const P2& p2,const P3& p3,Op op) { return detail::element_recursion::value>::static_for_each(p1,p2,p3,op); } ///\} -} } // namespace boost::gil +}} // namespace boost::gil #endif