From e3ef52bb80877168ab20746acd9aeda992d3794e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20=C5=81oskot?= Date: Tue, 15 Jan 2019 00:42:20 +0100 Subject: [PATCH] Correct order of constexpr and type specifier The constexpr belongs to the declaration specifiers (like static) and not just the type specifiers (like cv-qualifiers), so it binds to the declaration (like static), not the type (like const). Refines #211 --- example/mandelbrot.cpp | 2 +- include/boost/gil/bit_aligned_pixel_iterator.hpp | 2 +- .../boost/gil/bit_aligned_pixel_reference.hpp | 4 ++-- include/boost/gil/channel.hpp | 16 ++++++++-------- include/boost/gil/color_base_algorithm.hpp | 6 +++--- .../toolbox/image_types/subchroma_image.hpp | 4 ++-- include/boost/gil/image_view_factory.hpp | 8 ++++---- include/boost/gil/io/base.hpp | 8 ++++---- include/boost/gil/metafunctions.hpp | 2 +- include/boost/gil/packed_pixel.hpp | 2 +- include/boost/gil/pixel.hpp | 2 +- include/boost/gil/planar_pixel_reference.hpp | 2 +- include/boost/gil/premultiply.hpp | 2 +- include/boost/gil/utilities.hpp | 2 +- io/test/mandel_view.hpp | 2 +- test/channel.cpp | 2 +- test/channel/channel_concepts.cpp | 2 +- test/image.cpp | 2 +- 18 files changed, 35 insertions(+), 35 deletions(-) diff --git a/example/mandelbrot.cpp b/example/mandelbrot.cpp index 65bf89afe..0bcfc2ea1 100644 --- a/example/mandelbrot.cpp +++ b/example/mandelbrot.cpp @@ -24,7 +24,7 @@ struct mandelbrot_fn using const_reference = value_type; using argument_type = point_t; using result_type = reference; - static bool constexpr is_mutable =false; + static constexpr bool is_mutable =false; value_type _in_color,_out_color; point_t _img_size; diff --git a/include/boost/gil/bit_aligned_pixel_iterator.hpp b/include/boost/gil/bit_aligned_pixel_iterator.hpp index 327f89fb2..5e80471d1 100644 --- a/include/boost/gil/bit_aligned_pixel_iterator.hpp +++ b/include/boost/gil/bit_aligned_pixel_iterator.hpp @@ -69,7 +69,7 @@ public: bit_range_t& bit_range() { return _bit_range; } private: bit_range_t _bit_range; - static int constexpr bit_size = NonAlignedPixelReference::bit_size; + static constexpr int bit_size = NonAlignedPixelReference::bit_size; friend class boost::iterator_core_access; reference dereference() const { return NonAlignedPixelReference(_bit_range); } diff --git a/include/boost/gil/bit_aligned_pixel_reference.hpp b/include/boost/gil/bit_aligned_pixel_reference.hpp index 93b1a5907..da72f6346 100644 --- a/include/boost/gil/bit_aligned_pixel_reference.hpp +++ b/include/boost/gil/bit_aligned_pixel_reference.hpp @@ -118,7 +118,7 @@ public: template struct bit_aligned_pixel_reference { - static int constexpr bit_size = + static constexpr int bit_size = mpl::accumulate < ChannelBitSizes, @@ -136,7 +136,7 @@ struct bit_aligned_pixel_reference using reference = const bit_aligned_pixel_reference; using const_reference = bit_aligned_pixel_reference const; - static bool constexpr is_mutable = IsMutable; + static constexpr bool is_mutable = IsMutable; bit_aligned_pixel_reference(){} bit_aligned_pixel_reference(data_ptr_t data_ptr, int bit_offset) : _bit_range(data_ptr, bit_offset) {} diff --git a/include/boost/gil/channel.hpp b/include/boost/gil/channel.hpp index ad0f5c372..455a76d71 100644 --- a/include/boost/gil/channel.hpp +++ b/include/boost/gil/channel.hpp @@ -79,7 +79,7 @@ namespace detail { using pointer = typename T::pointer; using const_reference = typename T::const_reference; using const_pointer = typename T::const_pointer; - static bool constexpr is_mutable = T::is_mutable; + static constexpr bool is_mutable = T::is_mutable; static value_type min_value() { return T::min_value(); } static value_type max_value() { return T::max_value(); } }; @@ -92,7 +92,7 @@ namespace detail { using pointer = T*; using const_reference = T const&; using const_pointer = T const*; - static bool constexpr is_mutable = true; + static constexpr bool is_mutable = true; static value_type min_value() { return (std::numeric_limits::min)(); } static value_type max_value() { return (std::numeric_limits::max)(); } }; @@ -102,7 +102,7 @@ namespace detail { struct channel_traits_impl : public channel_traits_impl { using reference = const T &; using pointer = const T *; - static bool constexpr is_mutable = false; + static constexpr bool is_mutable = false; }; } @@ -136,7 +136,7 @@ struct channel_traits : public channel_traits { using reference = typename channel_traits::const_reference; using pointer = typename channel_traits::const_pointer; - static bool constexpr is_mutable = false; + static constexpr bool is_mutable = false; }; /////////////////////////////////////////// @@ -176,7 +176,7 @@ struct scoped_channel_value using pointer = value_type*; using const_reference = value_type const&; using const_pointer = value_type const*; - static bool constexpr is_mutable = channel_traits::is_mutable; + static constexpr bool is_mutable = channel_traits::is_mutable; using base_channel_t = BaseChannelValue; @@ -280,7 +280,7 @@ public: using const_reference = value_type const&; using pointer = value_type*; using const_pointer = value_type const*; - static bool constexpr is_mutable = true; + static constexpr bool is_mutable = true; static value_type min_value() { return 0; } static value_type max_value() { return low_bits_mask_t< NumBits >::sig_bits; } @@ -323,8 +323,8 @@ public: using reference = const Derived; using pointer = value_type *; using const_pointer = const value_type *; - static int constexpr num_bits = NumBits; - static bool constexpr is_mutable = Mutable; + static constexpr int num_bits = NumBits; + static constexpr bool is_mutable = Mutable; static value_type min_value() { return channel_traits::min_value(); } static value_type max_value() { return channel_traits::max_value(); } diff --git a/include/boost/gil/color_base_algorithm.hpp b/include/boost/gil/color_base_algorithm.hpp index 031a24c68..e0b77682e 100644 --- a/include/boost/gil/color_base_algorithm.hpp +++ b/include/boost/gil/color_base_algorithm.hpp @@ -81,7 +81,7 @@ red_channel = channel_traits::max_value(); template struct kth_semantic_element_type { - static int constexpr semantic_index = + static constexpr int semantic_index = mpl::at_c::type::value; using type = typename kth_element_type::type; }; @@ -91,7 +91,7 @@ struct kth_semantic_element_type template struct kth_semantic_element_reference_type { - static int constexpr semantic_index = + static constexpr int semantic_index = mpl::at_c < typename ColorBase::layout_t::channel_mapping_t, @@ -106,7 +106,7 @@ struct kth_semantic_element_reference_type /// \ingroup ColorBaseAlgorithmSemanticAtC template struct kth_semantic_element_const_reference_type { - static int constexpr semantic_index = + static constexpr int semantic_index = mpl::at_c < typename ColorBase::layout_t::channel_mapping_t, diff --git a/include/boost/gil/extension/toolbox/image_types/subchroma_image.hpp b/include/boost/gil/extension/toolbox/image_types/subchroma_image.hpp index 32293f04b..ebdafa7b8 100644 --- a/include/boost/gil/extension/toolbox/image_types/subchroma_image.hpp +++ b/include/boost/gil/extension/toolbox/image_types/subchroma_image.hpp @@ -47,14 +47,14 @@ struct scaling_factors > >::type::value, ""); - static int constexpr ss_X = + static constexpr int ss_X = mpl::divides < mpl::int_, mpl::int_ >::type::value; - static int constexpr ss_Y = + static constexpr int ss_Y = mpl::if_ < mpl::equal_to, mpl::int_<0>>, diff --git a/include/boost/gil/image_view_factory.hpp b/include/boost/gil/image_view_factory.hpp index ffa91122a..fbeee8161 100644 --- a/include/boost/gil/image_view_factory.hpp +++ b/include/boost/gil/image_view_factory.hpp @@ -320,7 +320,7 @@ namespace detail { // Determines whether the channels of a given pixel iterator are adjacent in memory. // Planar and grayscale iterators have channels adjacent in memory, whereas multi-channel interleaved and iterators with non-fundamental step do not. - static bool constexpr adjacent = + static constexpr bool adjacent = !iterator_is_step::value && (is_planar::value || num_channels::value == 1); @@ -340,7 +340,7 @@ namespace detail { // Examples: pixel, pixel&, const pixel&, planar_pixel_reference, planar_pixel_reference struct nth_channel_deref_fn { - static bool constexpr is_mutable = + static constexpr bool is_mutable = pixel_is_reference::value && pixel_reference_is_mutable::value; private: using src_pixel_t = typename remove_reference::type; @@ -454,7 +454,7 @@ namespace detail { // Determines whether the channels of a given pixel iterator are adjacent in memory. // Planar and grayscale iterators have channels adjacent in memory, whereas multi-channel interleaved and iterators with non-fundamental step do not. - static bool constexpr adjacent = + static constexpr bool adjacent = !iterator_is_step::value && (is_planar::value || num_channels::value == 1); @@ -475,7 +475,7 @@ namespace detail { template struct kth_channel_deref_fn { - static bool constexpr is_mutable = + static constexpr bool is_mutable = pixel_is_reference::value && pixel_reference_is_mutable::value; private: diff --git a/include/boost/gil/io/base.hpp b/include/boost/gil/io/base.hpp index 4215ddf11..e7a5b1a71 100644 --- a/include/boost/gil/io/base.hpp +++ b/include/boost/gil/io/base.hpp @@ -91,10 +91,10 @@ struct property_base } // namespace detail -struct read_support_true { static bool constexpr is_supported = true; }; -struct read_support_false { static bool constexpr is_supported = false; }; -struct write_support_true { static bool constexpr is_supported = true; }; -struct write_support_false{ static bool constexpr is_supported = false; }; +struct read_support_true { static constexpr bool is_supported = true; }; +struct read_support_false { static constexpr bool is_supported = false; }; +struct write_support_true { static constexpr bool is_supported = true; }; +struct write_support_false{ static constexpr bool is_supported = false; }; class no_log {}; diff --git a/include/boost/gil/metafunctions.hpp b/include/boost/gil/metafunctions.hpp index 895a21a9c..d7a99d0d7 100644 --- a/include/boost/gil/metafunctions.hpp +++ b/include/boost/gil/metafunctions.hpp @@ -331,7 +331,7 @@ template struct bit_aligned_image_type { private: - static int constexpr bit_size = + static constexpr int bit_size = mpl::accumulate < ChannelBitSizeVector, diff --git a/include/boost/gil/packed_pixel.hpp b/include/boost/gil/packed_pixel.hpp index 4e33ef275..2d5b695db 100644 --- a/include/boost/gil/packed_pixel.hpp +++ b/include/boost/gil/packed_pixel.hpp @@ -57,7 +57,7 @@ struct packed_pixel using reference = value_type&; using const_reference = value_type const&; - static bool constexpr is_mutable = + static constexpr bool is_mutable = channel_traits::type>::is_mutable; packed_pixel(){} diff --git a/include/boost/gil/pixel.hpp b/include/boost/gil/pixel.hpp index 886adfc79..da7306db1 100644 --- a/include/boost/gil/pixel.hpp +++ b/include/boost/gil/pixel.hpp @@ -98,7 +98,7 @@ public: using value_type = pixel; using reference = value_type&; using const_reference = value_type const&; - static bool constexpr is_mutable = channel_traits::is_mutable; + static constexpr bool is_mutable = channel_traits::is_mutable; pixel(){} explicit pixel(channel_t v) : parent_t(v) {} // sets all channels to v diff --git a/include/boost/gil/planar_pixel_reference.hpp b/include/boost/gil/planar_pixel_reference.hpp index 0495f9701..5a10eb2d0 100644 --- a/include/boost/gil/planar_pixel_reference.hpp +++ b/include/boost/gil/planar_pixel_reference.hpp @@ -44,7 +44,7 @@ private: using channel_const_reference = typename channel_traits::const_reference; public: - static bool constexpr is_mutable = channel_traits::is_mutable; + static constexpr bool is_mutable = channel_traits::is_mutable; using value_type = pixel>; using reference = planar_pixel_reference; using const_reference = planar_pixel_reference; diff --git a/include/boost/gil/premultiply.hpp b/include/boost/gil/premultiply.hpp index 043431ea5..cb76b8d9c 100644 --- a/include/boost/gil/premultiply.hpp +++ b/include/boost/gil/premultiply.hpp @@ -78,7 +78,7 @@ public: using const_reference = const value_type &; using argument_type = SrcConstRefP; using result_type = reference; - static bool constexpr is_mutable = false; + static constexpr bool is_mutable = false; result_type operator()(argument_type srcP) const { diff --git a/include/boost/gil/utilities.hpp b/include/boost/gil/utilities.hpp index 5758c4249..b1a8684a4 100644 --- a/include/boost/gil/utilities.hpp +++ b/include/boost/gil/utilities.hpp @@ -94,7 +94,7 @@ struct deref_base using value_type = Value; using reference = Reference; using const_reference = ConstReference; - static bool constexpr is_mutable = IsMutable; + static constexpr bool is_mutable = IsMutable; }; /// \brief Composes two dereference function objects. Similar to std::unary_compose but needs to pull some aliases from the component types. Models: PixelDereferenceAdaptorConcept diff --git a/io/test/mandel_view.hpp b/io/test/mandel_view.hpp index f1100f913..4c7b89216 100644 --- a/io/test/mandel_view.hpp +++ b/io/test/mandel_view.hpp @@ -25,7 +25,7 @@ struct mandelbrot_fn using const_reference = value_type; using argument_type = point_t; using result_type = reference; - static bool constexpr is_mutable = false; + static constexpr bool is_mutable = false; value_type _in_color,_out_color; point_t _img_size; diff --git a/test/channel.cpp b/test/channel.cpp index f99fdf5f9..8757a0e2f 100644 --- a/test/channel.cpp +++ b/test/channel.cpp @@ -296,7 +296,7 @@ struct channel_archetype { using const_reference = channel_archetype const; using pointer = channel_value_archetype *; using const_pointer = channel_value_archetype const*; - static bool constexpr is_mutable=true; + static constexpr bool is_mutable=true; static value_type min_value(); static value_type max_value(); diff --git a/test/channel/channel_concepts.cpp b/test/channel/channel_concepts.cpp index 114384503..eebd068f3 100644 --- a/test/channel/channel_concepts.cpp +++ b/test/channel/channel_concepts.cpp @@ -52,7 +52,7 @@ struct channel_archetype using const_reference = channel_archetype const; using pointer = channel_value_archetype*; using const_pointer = channel_value_archetype const*; - static bool constexpr is_mutable = true; + static constexpr bool is_mutable = true; static value_type min_value(); static value_type max_value(); diff --git a/test/image.cpp b/test/image.cpp index 21a8a9618..7f161b7f0 100644 --- a/test/image.cpp +++ b/test/image.cpp @@ -97,7 +97,7 @@ struct mandelbrot_fn using const_reference = value_type; using argument_type = point_t; using result_type = reference; - static bool constexpr is_mutable = false; + static constexpr bool is_mutable = false; value_type _in_color,_out_color; point_t _img_size;