diff --git a/.appveyor.yml b/.appveyor.yml index 4d227968e1..7190937753 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -96,7 +96,6 @@ before_build: - git submodule --quiet update --init libs/numeric/conversion - git submodule --quiet update --init libs/preprocessor - git submodule --quiet update --init libs/smart_ptr - - git submodule --quiet update --init libs/static_assert - git submodule --quiet update --init libs/test - git submodule --quiet update --init libs/type_traits ## Transitive @@ -120,6 +119,7 @@ before_build: - git submodule --quiet update --init libs/ratio - git submodule --quiet update --init libs/rational - git submodule --quiet update --init libs/regex + - git submodule --quiet update --init libs/static_assert - git submodule --quiet update --init libs/system - git submodule --quiet update --init libs/throw_exception - git submodule --quiet update --init libs/timer diff --git a/.travis.yml b/.travis.yml index 25d8647bfd..ed4ab386b2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -212,7 +212,6 @@ install: - git submodule --quiet update --init libs/mpl - git submodule --quiet update --init libs/numeric/conversion - git submodule --quiet update --init libs/preprocessor - - git submodule --quiet update --init libs/static_assert - git submodule --quiet update --init libs/test - git submodule --quiet update --init libs/type_traits ## Transitive @@ -237,6 +236,7 @@ install: - git submodule --quiet update --init libs/ratio - git submodule --quiet update --init libs/rational - git submodule --quiet update --init libs/regex + - git submodule --quiet update --init libs/static_assert - git submodule --quiet update --init libs/smart_ptr - git submodule --quiet update --init libs/system - git submodule --quiet update --init libs/throw_exception diff --git a/doc/design_guide.rst b/doc/design_guide.rst index ec9c036bcb..79b267dab9 100644 --- a/doc/design_guide.rst +++ b/doc/design_guide.rst @@ -808,7 +808,7 @@ provides a model for such packed pixel formats:: typedef packed_pixel_type, rgb_layout_t>::type rgb565_pixel_t; function_requires >(); - BOOST_STATIC_ASSERT((sizeof(rgb565_pixel_t)==2)); + static_assert(sizeof(rgb565_pixel_t) == 2, ""); // define a bgr556 pixel typedef packed_pixel_type, bgr_layout_t>::type bgr556_pixel_t; @@ -838,7 +838,7 @@ pixels and pixel iterators:: // BGR232 pixel value. It is a packed_pixel of size 1 byte. (The last bit is unused) typedef std::iterator_traits::value_type bgr232_pixel_t; - BOOST_STATIC_ASSERT((sizeof(bgr232_pixel_t)==1)); + static_assert(sizeof(bgr232_pixel_t) == 1, ""); bgr232_pixel_t red(0,0,3); // = 0RRGGGBB, = 01100000 = 0x60 @@ -1959,7 +1959,7 @@ an example:: #include using namespace boost; - #define ASSERT_SAME(A,B) BOOST_STATIC_ASSERT((is_same< A,B >::value)) + #define ASSERT_SAME(A,B) static_assert(is_same< A,B >::value, "") // Define the set of allowed images typedef mpl::vector my_images_t; @@ -2380,7 +2380,7 @@ HomogeneousPixelBasedConcept and metafunctions built on top of them:: These are metafunctions, some of which return integral types which can be evaluated like this:: - BOOST_STATIC_ASSERT(is_planar::value == true); + static_assert(is_planar::value == true, ""); GIL also supports type analysis metafunctions of the form: [pixel_reference/iterator/locator/view/image] + "_is_" + @@ -2537,10 +2537,10 @@ Here is how to use pixels in generic code:: gil_function_requires >(); typedef typename color_space_type::type gray_cs_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); typedef typename color_space_type::type rgb_cs_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); typedef typename channel_type::type gray_channel_t; typedef typename channel_type::type rgb_channel_t; diff --git a/doc/doxygen/design_guide.dox b/doc/doxygen/design_guide.dox index fce4ecb47c..6eda18d8f5 100644 --- a/doc/doxygen/design_guide.dox +++ b/doc/doxygen/design_guide.dox @@ -886,7 +886,7 @@ channels occupy bits [0..4],[5..9] and [10..15] respectively. GIL provides a mod typedef packed_pixel_type, rgb_layout_t>::type rgb565_pixel_t; function_requires >(); -BOOST_STATIC_ASSERT((sizeof(rgb565_pixel_t)==2)); +static_assert(sizeof(rgb565_pixel_t) == 2, ""); // define a bgr556 pixel typedef packed_pixel_type, bgr_layout_t>::type bgr556_pixel_t; @@ -912,7 +912,7 @@ typedef bit_aligned_pixel_iterator bgr232_ptr_t; // BGR232 pixel value. It is a packed_pixel of size 1 byte. (The last bit is unused) typedef std::iterator_traits::value_type bgr232_pixel_t; -BOOST_STATIC_ASSERT((sizeof(bgr232_pixel_t)==1)); +static_assert(sizeof(bgr232_pixel_t) == 1, ""); bgr232_pixel_t red(0,0,3); // = 0RRGGGBB, = 01100000 = 0x60 @@ -1965,7 +1965,7 @@ depth. How can we possibly write this using our generic image? What type is the #include using namespace boost; -#define ASSERT_SAME(A,B) BOOST_STATIC_ASSERT((is_same< A,B >::value)) +#define ASSERT_SAME(A,B) static_assert(is_same< A,B >::value, "") // Define the set of allowed images typedef mpl::vector my_images_t; @@ -2351,7 +2351,7 @@ template struct num_channels { typedef ... type; }; These are metafunctions, some of which return integral types which can be evaluated like this: \code -BOOST_STATIC_ASSERT(is_planar::value == true); +static_assert(is_planar::value == true, ""); \endcode \endcode @@ -2493,10 +2493,10 @@ void gray_to_rgb(const GrayPixel& src, RGBPixel& dst) { gil_function_requires >(); typedef typename color_space_type::type gray_cs_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); typedef typename color_space_type::type rgb_cs_t; - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); typedef typename channel_type::type gray_channel_t; typedef typename channel_type::type rgb_channel_t; diff --git a/include/boost/gil/bit_aligned_pixel_reference.hpp b/include/boost/gil/bit_aligned_pixel_reference.hpp index 74cc7be452..a3d7c8d722 100644 --- a/include/boost/gil/bit_aligned_pixel_reference.hpp +++ b/include/boost/gil/bit_aligned_pixel_reference.hpp @@ -130,8 +130,10 @@ struct bit_aligned_pixel_reference { template bit_aligned_pixel_reference(const bit_aligned_pixel_reference& p) : _bit_range(p._bit_range) {} // Grayscale references can be constructed from the channel reference - explicit bit_aligned_pixel_reference(const typename kth_element_type::type channel0) : _bit_range(static_cast(&channel0), channel0.first_bit()) { - BOOST_STATIC_ASSERT((num_channels::value==1)); + explicit bit_aligned_pixel_reference(typename kth_element_type::type const channel0) + : _bit_range(static_cast(&channel0), channel0.first_bit()) + { + static_assert(num_channels::value == 1, ""); } // Construct from another compatible pixel type @@ -159,7 +161,11 @@ struct bit_aligned_pixel_reference { template bool equal(const Pixel& p, mpl::true_) const { check_compatible(); return static_equal(*this,p); } private: - static void check_gray() { BOOST_STATIC_ASSERT((is_same::value)); } + static void check_gray() + { + static_assert(is_same::value, ""); + } + template void assign(const Channel& chan, mpl::false_) const { check_gray(); gil::at_c<0>(*this)=chan; } template bool equal (const Channel& chan, mpl::false_) const { check_gray(); return gil::at_c<0>(*this)==chan; } }; diff --git a/include/boost/gil/channel.hpp b/include/boost/gil/channel.hpp index 2dd27e4636..697713590c 100644 --- a/include/boost/gil/channel.hpp +++ b/include/boost/gil/channel.hpp @@ -262,7 +262,7 @@ using bits4 = packed_channel_value<4>; assert(channel_traits::min_value()==0); assert(channel_traits::max_value()==15); assert(sizeof(bits4)==1); -BOOST_STATIC_ASSERT((boost::is_integral::value)); +static_assert(boost::is_integral::value, ""); \endcode */ diff --git a/include/boost/gil/color_base_algorithm.hpp b/include/boost/gil/color_base_algorithm.hpp index 0ebca46cbb..7303c5b710 100644 --- a/include/boost/gil/color_base_algorithm.hpp +++ b/include/boost/gil/color_base_algorithm.hpp @@ -34,8 +34,8 @@ namespace boost { namespace gil { Example: \code -BOOST_STATIC_ASSERT((size::value == 3)); -BOOST_STATIC_ASSERT((size::value == 4)); +static_assert(size::value == 3, ""); +static_assert(size::value == 4, ""); \endcode */ @@ -133,7 +133,7 @@ Example: A function that takes a generic pixel containing a red channel and sets template void set_red_to_max(Pixel& pixel) { boost::function_requires >(); - BOOST_STATIC_ASSERT((contains_color::value)); + static_assert(contains_color::value, ""); using red_channel_t = typename color_element_type::type; get_color(pixel, red_t()) = channel_traits::max_value(); @@ -192,7 +192,7 @@ typename color_element_const_reference_type::type get_color(con Example: \code using element_t = element_type::type; -BOOST_STATIC_ASSERT((boost::is_same::value)); +static_assert(boost::is_same::value, ""); \endcode */ /// \brief Specifies the element type of a homogeneous color base diff --git a/include/boost/gil/concepts/basic.hpp b/include/boost/gil/concepts/basic.hpp index 238172d88f..a1a1c84f62 100644 --- a/include/boost/gil/concepts/basic.hpp +++ b/include/boost/gil/concepts/basic.hpp @@ -168,7 +168,7 @@ struct SameType { void constraints() { - BOOST_STATIC_ASSERT((boost::is_same::value_core)); + static_assert(boost::is_same::value_core, ""); } }; diff --git a/include/boost/gil/concepts/channel.hpp b/include/boost/gil/concepts/channel.hpp index 322fb3f0b6..ff2538ade4 100644 --- a/include/boost/gil/concepts/channel.hpp +++ b/include/boost/gil/concepts/channel.hpp @@ -140,7 +140,7 @@ struct ChannelValueConcept /// Example: /// /// \code -/// BOOST_STATIC_ASSERT((channels_are_compatible::value)); +/// static_assert(channels_are_compatible::value, ""); /// \endcode /// \ingroup ChannelAlgorithm template // Models GIL Pixel @@ -167,7 +167,7 @@ struct ChannelsCompatibleConcept { void constraints() { - BOOST_STATIC_ASSERT((channels_are_compatible::value)); + static_assert(channels_are_compatible::value, ""); } }; diff --git a/include/boost/gil/concepts/color.hpp b/include/boost/gil/concepts/color.hpp index 042a82d4e0..7058e05203 100644 --- a/include/boost/gil/concepts/color.hpp +++ b/include/boost/gil/concepts/color.hpp @@ -57,7 +57,7 @@ struct ColorSpacesCompatibleConcept { void constraints() { - BOOST_STATIC_ASSERT((color_spaces_are_compatible::value)); + static_assert(color_spaces_are_compatible::value, ""); } }; diff --git a/include/boost/gil/concepts/color_base.hpp b/include/boost/gil/concepts/color_base.hpp index 9999dea3df..b20b731383 100644 --- a/include/boost/gil/concepts/color_base.hpp +++ b/include/boost/gil/concepts/color_base.hpp @@ -229,7 +229,7 @@ struct HomogeneousColorBaseConcept using T0 = typename kth_element_type::type; using TN = typename kth_element_type::type; - BOOST_STATIC_ASSERT((is_same::value)); // better than nothing + static_assert(is_same::value, ""); // better than nothing using R0 = typename kth_element_const_reference_type::type; R0 r = dynamic_at_c(cb, 0); @@ -296,11 +296,11 @@ struct ColorBasesCompatibleConcept { void constraints() { - BOOST_STATIC_ASSERT((is_same + static_assert(is_same < typename ColorBase1::layout_t::color_space_t, typename ColorBase2::layout_t::color_space_t - >::value)); + >::value, ""); // using e1 = typename kth_semantic_element_type::type; // using e2 = typename kth_semantic_element_type::type; diff --git a/include/boost/gil/concepts/image.hpp b/include/boost/gil/concepts/image.hpp index c9bbc2526a..14f723e2d6 100644 --- a/include/boost/gil/concepts/image.hpp +++ b/include/boost/gil/concepts/image.hpp @@ -141,10 +141,10 @@ struct ImageConcept gil_function_requires>(); gil_function_requires>(); using coord_t = typename Image::coord_t; - BOOST_STATIC_ASSERT(num_channels::value == mpl::size::type>::value); + static_assert(num_channels::value == mpl::size::type>::value, ""); - BOOST_STATIC_ASSERT((is_same::value)); - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); + static_assert(is_same::value, ""); } Image image; }; diff --git a/include/boost/gil/concepts/image_view.hpp b/include/boost/gil/concepts/image_view.hpp index dd25f09143..146d64f5cb 100644 --- a/include/boost/gil/concepts/image_view.hpp +++ b/include/boost/gil/concepts/image_view.hpp @@ -120,22 +120,22 @@ struct RandomAccessNDImageViewConcept gil_function_requires>(); gil_function_requires>(); -// BOOST_STATIC_ASSERT((typename std::iterator_traits::difference_type, typename point_t::template axis<0>::coord_t>::value)); -// BOOST_STATIC_ASSERT((typename std::iterator_traits::difference_type, typename point_t::template axis::coord_t>::value)); +// static_assert(typename std::iterator_traits::difference_type, typename point_t::template axis<0>::coord_t>::value, ""); +// static_assert(typename std::iterator_traits::difference_type, typename point_t::template axis::coord_t>::value, ""); // point_t must be an N-dimensional point, each dimension of which must have the same type as difference_type of the corresponding iterator gil_function_requires>(); - BOOST_STATIC_ASSERT(point_t::num_dimensions==N); - BOOST_STATIC_ASSERT((is_same + static_assert(point_t::num_dimensions == N, ""); + static_assert(is_same < typename std::iterator_traits::difference_type, typename point_t::template axis<0>::coord_t - >::value)); - BOOST_STATIC_ASSERT((is_same + >::value, ""); + static_assert(is_same < typename std::iterator_traits::difference_type, typename point_t::template axis::coord_t - >::value)); + >::value, ""); point_t p; locator lc; @@ -215,7 +215,7 @@ struct RandomAccess2DImageViewConcept void constraints() { gil_function_requires>(); - BOOST_STATIC_ASSERT(View::num_dimensions==2); + static_assert(View::num_dimensions == 2, ""); // TODO: This executes the requirements for RandomAccessNDLocatorConcept again. Fix it to improve compile time gil_function_requires>(); @@ -373,7 +373,7 @@ struct ImageViewConcept // TODO: This executes the requirements for RandomAccess2DLocatorConcept again. Fix it to improve compile time gil_function_requires>(); - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); using coord_t = typename View::coord_t; // 1D difference type (same for all dimensions) std::size_t num_chan = view.num_channels(); ignore_unused_variable_warning(num_chan); @@ -532,7 +532,7 @@ struct ViewsCompatibleConcept { void constraints() { - BOOST_STATIC_ASSERT((views_are_compatible::value)); + static_assert(views_are_compatible::value, ""); } }; diff --git a/include/boost/gil/concepts/pixel.hpp b/include/boost/gil/concepts/pixel.hpp index c0e020eafa..fb8ddb675d 100644 --- a/include/boost/gil/concepts/pixel.hpp +++ b/include/boost/gil/concepts/pixel.hpp @@ -63,7 +63,7 @@ struct PixelConcept gil_function_requires>(); gil_function_requires>(); - BOOST_STATIC_ASSERT((is_pixel

::value)); + static_assert(is_pixel

::value, ""); static const bool is_mutable = P::is_mutable; ignore_unused_variable_warning(is_mutable); @@ -99,7 +99,7 @@ struct MutablePixelConcept void constraints() { gil_function_requires>(); - BOOST_STATIC_ASSERT(P::is_mutable); + static_assert(P::is_mutable, ""); } }; @@ -187,7 +187,7 @@ struct HomogeneousPixelValueConcept { gil_function_requires>(); gil_function_requires>(); - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); } }; @@ -258,7 +258,7 @@ struct PixelsCompatibleConcept { void constraints() { - BOOST_STATIC_ASSERT((pixels_are_compatible::value)); + static_assert(pixels_are_compatible::value, ""); } }; diff --git a/include/boost/gil/concepts/pixel_iterator.hpp b/include/boost/gil/concepts/pixel_iterator.hpp index 2cd12d6604..66bf1e7501 100644 --- a/include/boost/gil/concepts/pixel_iterator.hpp +++ b/include/boost/gil/concepts/pixel_iterator.hpp @@ -354,7 +354,7 @@ struct IteratorAdaptorConcept using base_t = typename iterator_adaptor_get_base::type; gil_function_requires>(); - BOOST_STATIC_ASSERT(is_iterator_adaptor::value); + static_assert(is_iterator_adaptor::value, ""); using rebind_t = typename iterator_adaptor_rebind::type; base_t base = it.base(); diff --git a/include/boost/gil/concepts/pixel_locator.hpp b/include/boost/gil/concepts/pixel_locator.hpp index 5b5ccefc71..2513f80196 100644 --- a/include/boost/gil/concepts/pixel_locator.hpp +++ b/include/boost/gil/concepts/pixel_locator.hpp @@ -133,17 +133,17 @@ struct RandomAccessNDLocatorConcept // point_t must be an N-dimensional point, each dimension of which must // have the same type as difference_type of the corresponding iterator gil_function_requires>(); - BOOST_STATIC_ASSERT(point_t::num_dimensions==N); - BOOST_STATIC_ASSERT((is_same + static_assert(point_t::num_dimensions == N, ""); + static_assert(is_same < typename std::iterator_traits::difference_type, typename point_t::template axis<0>::coord_t - >::value)); - BOOST_STATIC_ASSERT((is_same + >::value, ""); + static_assert(is_same < typename std::iterator_traits::difference_type, typename point_t::template axis::coord_t - >::value)); + >::value, ""); difference_type d; loc += d; @@ -214,7 +214,7 @@ struct RandomAccess2DLocatorConcept void constraints() { gil_function_requires>(); - BOOST_STATIC_ASSERT(Loc::num_dimensions==2); + static_assert(Loc::num_dimensions == 2, ""); using dynamic_x_step_t = typename dynamic_x_step_type::type; using dynamic_y_step_t = typename dynamic_y_step_type::type; @@ -287,7 +287,7 @@ struct PixelLocatorConcept gil_function_requires>(); gil_function_requires>(); using coord_t = typename Loc::coord_t; - BOOST_STATIC_ASSERT((is_same::value)); + static_assert(is_same::value, ""); } Loc loc; }; diff --git a/include/boost/gil/concepts/point.hpp b/include/boost/gil/concepts/point.hpp index 279ccc373a..6b2bdf5880 100644 --- a/include/boost/gil/concepts/point.hpp +++ b/include/boost/gil/concepts/point.hpp @@ -99,7 +99,7 @@ struct Point2DConcept void constraints() { gil_function_requires>(); - BOOST_STATIC_ASSERT(P::num_dimensions == 2); + static_assert(P::num_dimensions == 2, ""); point.x = point.y; point[0] = point[1]; } diff --git a/include/boost/gil/extension/io/pnm/detail/write.hpp b/include/boost/gil/extension/io/pnm/detail/write.hpp index c1306d5508..d9e8d8d608 100644 --- a/include/boost/gil/extension/io/pnm/detail/write.hpp +++ b/include/boost/gil/extension/io/pnm/detail/write.hpp @@ -131,10 +131,7 @@ class writer< Device , const mpl::true_& // bit_aligned ) { - BOOST_STATIC_ASSERT(( is_same< View - , typename gray1_image_t::view_t - >::value - )); + static_assert(is_same::value, ""); byte_vector_t row( pitch / 8 ); diff --git a/include/boost/gil/extension/io/tiff/detail/read.hpp b/include/boost/gil/extension/io/tiff/detail/read.hpp index 2d777669b6..2a790610eb 100644 --- a/include/boost/gil/extension/io/tiff/detail/read.hpp +++ b/include/boost/gil/extension/io/tiff/detail/read.hpp @@ -20,8 +20,6 @@ #include #include -#include - #include #include #include diff --git a/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp b/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp index 92197faf25..a10264d4a5 100644 --- a/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp +++ b/include/boost/gil/extension/io/tiff/detail/scanline_read.hpp @@ -21,7 +21,6 @@ #include #include -#include #include #include diff --git a/include/boost/gil/extension/io/tiff/detail/write.hpp b/include/boost/gil/extension/io/tiff/detail/write.hpp index 4530061edd..c2d2099921 100644 --- a/include/boost/gil/extension/io/tiff/detail/write.hpp +++ b/include/boost/gil/extension/io/tiff/detail/write.hpp @@ -17,8 +17,6 @@ #include #include -#include - #include #include #include 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 db8a201ab3..4ad151959d 100644 --- a/include/boost/gil/extension/toolbox/image_types/subchroma_image.hpp +++ b/include/boost/gil/extension/toolbox/image_types/subchroma_image.hpp @@ -31,23 +31,21 @@ namespace detail { template< int J, int A, int B> struct scaling_factors { - BOOST_STATIC_ASSERT(( mpl::equal_to< mpl::int_< J >, mpl::int_< 4 > >::type::value )); + static_assert(mpl::equal_to< mpl::int_< J >, mpl::int_< 4 > >::type::value, ""); - BOOST_STATIC_ASSERT(( mpl::or_< mpl::equal_to< mpl::int_, mpl::int_< 4 > > + static_assert(mpl::or_, mpl::int_< 4 > > , mpl::or_< mpl::equal_to< mpl::int_, mpl::int_< 2 > > , mpl::equal_to< mpl::int_, mpl::int_< 1 > > > - >::type::value - )); + >::type::value, ""); - BOOST_STATIC_ASSERT(( mpl::or_< mpl::equal_to< mpl::int_, mpl::int_< 4 > > + static_assert(mpl::or_< mpl::equal_to< mpl::int_, mpl::int_< 4 > > , mpl::or_< mpl::equal_to< mpl::int_, mpl::int_< 2 > > , mpl::or_< mpl::equal_to< mpl::int_, mpl::int_< 1 > > , mpl::equal_to< mpl::int_, mpl::int_< 0 > > > > - >::type::value - )); + >::type::value, ""); BOOST_STATIC_CONSTANT( int, ss_X = ( mpl::divides< mpl::int_< J > , mpl::int_ diff --git a/include/boost/gil/image_view_factory.hpp b/include/boost/gil/image_view_factory.hpp index 39886976d8..599ca4229c 100644 --- a/include/boost/gil/image_view_factory.hpp +++ b/include/boost/gil/image_view_factory.hpp @@ -89,8 +89,8 @@ namespace detail { /// \brief Returns C pointer to the the channels of an interleaved homogeneous view. template typename detail::channel_pointer_type::type interleaved_view_get_raw_data(const HomogeneousView& view) { - BOOST_STATIC_ASSERT((!is_planar::value && view_is_basic::value)); - BOOST_STATIC_ASSERT((boost::is_pointer::value)); + static_assert(!is_planar::value && view_is_basic::value, ""); + static_assert(boost::is_pointer::value, ""); return &gil::at_c<0>(view(0,0)); } @@ -99,7 +99,7 @@ typename detail::channel_pointer_type::type interleaved_view_ge /// \brief Returns C pointer to the the channels of a given color plane of a planar homogeneous view. template typename detail::channel_pointer_type::type planar_view_get_raw_data(const HomogeneousView& view, int plane_index) { - BOOST_STATIC_ASSERT((is_planar::value && view_is_basic::value)); + static_assert(is_planar::value && view_is_basic::value, ""); return dynamic_at_c(view.row_begin(0),plane_index); } diff --git a/include/boost/gil/packed_pixel.hpp b/include/boost/gil/packed_pixel.hpp index c603ff1445..8874c6b589 100644 --- a/include/boost/gil/packed_pixel.hpp +++ b/include/boost/gil/packed_pixel.hpp @@ -34,7 +34,7 @@ namespace boost { namespace gil { Example: \code using rgb565_pixel_t = packed_pixel_type, rgb_layout_t>::type; -BOOST_STATIC_ASSERT((sizeof(rgb565_pixel_t)==2)); +static_assert(sizeof(rgb565_pixel_t) == 2, ""); rgb565_pixel_t r565; get_color(r565,red_t()) = 31; @@ -71,21 +71,21 @@ struct packed_pixel boost::ignore_unused(d); } packed_pixel(int chan0, int chan1) : _bitfield(0) { - BOOST_STATIC_ASSERT((num_channels::value==2)); + static_assert(num_channels::value == 2, ""); gil::at_c<0>(*this)=chan0; gil::at_c<1>(*this)=chan1; } packed_pixel(int chan0, int chan1, int chan2) : _bitfield(0) { - BOOST_STATIC_ASSERT((num_channels::value==3)); + static_assert(num_channels::value == 3, ""); gil::at_c<0>(*this) = chan0; gil::at_c<1>(*this) = chan1; gil::at_c<2>(*this) = chan2; } packed_pixel(int chan0, int chan1, int chan2, int chan3) : _bitfield(0) { - BOOST_STATIC_ASSERT((num_channels::value==4)); + static_assert(num_channels::value == 4, ""); gil::at_c<0>(*this)=chan0; gil::at_c<1>(*this)=chan1; gil::at_c<2>(*this)=chan2; gil::at_c<3>(*this)=chan3; } packed_pixel(int chan0, int chan1, int chan2, int chan3, int chan4) : _bitfield(0) { - BOOST_STATIC_ASSERT((num_channels::value==5)); + static_assert(num_channels::value == 5, ""); gil::at_c<0>(*this)=chan0; gil::at_c<1>(*this)=chan1; gil::at_c<2>(*this)=chan2; gil::at_c<3>(*this)=chan3; gil::at_c<4>(*this)=chan4; } @@ -102,7 +102,10 @@ struct packed_pixel template bool equal(const Pixel& p, mpl::true_) const { check_compatible(); return static_equal(*this,p); } // Support for assignment/equality comparison of a channel with a grayscale pixel - static void check_gray() { BOOST_STATIC_ASSERT((is_same::value)); } + static void check_gray() + { + static_assert(is_same::value, ""); + } template void assign(const Channel& chan, mpl::false_) { check_gray(); gil::at_c<0>(*this)=chan; } template bool equal (const Channel& chan, mpl::false_) const { check_gray(); return gil::at_c<0>(*this)==chan; } public: diff --git a/include/boost/gil/pixel.hpp b/include/boost/gil/pixel.hpp index b2735da5af..111fa389ea 100644 --- a/include/boost/gil/pixel.hpp +++ b/include/boost/gil/pixel.hpp @@ -54,14 +54,14 @@ struct num_channels : public mpl::size::ty Example: \code -BOOST_STATIC_ASSERT((num_channels::value==3)); -BOOST_STATIC_ASSERT((num_channels::value==4)); - -BOOST_STATIC_ASSERT((is_planar::value)); -BOOST_STATIC_ASSERT((is_same::type, rgb_t>::value)); -BOOST_STATIC_ASSERT((is_same::type, - channel_mapping_type::type>::value)); -BOOST_STATIC_ASSERT((is_same::type, uint8_t>::value)); +static_assert(num_channels::value == 3, ""); +static_assert(num_channels::value == 4, ""); + +static_assert(is_planar::value)); +static_assert(is_same::type, rgb_t>::value, ""); +static_assert(is_same::type, + channel_mapping_type::type>::value, ""); +static_assert(is_same::type, uint8_t>::value, ""); \endcode */ @@ -134,7 +134,10 @@ struct pixel : public detail::homogeneous_color_base::value)); } + static void check_gray() + { + static_assert(is_same::value, ""); + } template void assign(const Channel& chan, mpl::false_) { check_gray(); gil::at_c<0>(*this)=chan; } template bool equal (const Channel& chan, mpl::false_) const { check_gray(); return gil::at_c<0>(*this)==chan; } public: diff --git a/include/boost/gil/utilities.hpp b/include/boost/gil/utilities.hpp index d8a1478988..77063545d6 100644 --- a/include/boost/gil/utilities.hpp +++ b/include/boost/gil/utilities.hpp @@ -15,7 +15,6 @@ #include #include #include -#include #include #include diff --git a/io/test/make.cpp b/io/test/make.cpp index 41667d02e1..a1d91b8e6a 100644 --- a/io/test/make.cpp +++ b/io/test/make.cpp @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_SUITE( gil_io_tests ) BOOST_AUTO_TEST_CASE( make_reader_backend_test ) { { - BOOST_STATIC_ASSERT(( boost::is_same< gil::detail::is_supported_path_spec< char* >::type, mpl::true_ >::value )); + static_assert(boost::is_same::type, mpl::true_>::value, ""); get_reader_backend< const char*, bmp_tag >::type backend_char = make_reader_backend( bmp_filename.c_str(), bmp_tag() ); get_reader_backend< std::string, bmp_tag >::type backend_string = make_reader_backend( bmp_filename, bmp_tag() ); @@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE( make_writer_test ) { using writer_t = get_writer::type; - BOOST_STATIC_ASSERT(( boost::is_same< gil::detail::is_writer< writer_t >::type, boost::mpl::true_ >::value )); + static_assert(boost::is_same::type, boost::mpl::true_>::value, ""); } { diff --git a/test/image.cpp b/test/image.cpp index f90e227b1c..cc1c53903c 100644 --- a/test/image.cpp +++ b/test/image.cpp @@ -501,25 +501,25 @@ const string ref_dir=in_dir+"image-ref/"; // reference directory to compare wri void static_checks() { gil_function_requires >(); - BOOST_STATIC_ASSERT(view_is_basic::value); - BOOST_STATIC_ASSERT(view_is_basic::value); - BOOST_STATIC_ASSERT(view_is_basic::value); + static_assert(view_is_basic::value, ""); + static_assert(view_is_basic::value, ""); + static_assert(view_is_basic::value, ""); - BOOST_STATIC_ASSERT(view_is_step_in_x::value); - BOOST_STATIC_ASSERT(view_is_step_in_x::value); - BOOST_STATIC_ASSERT(!view_is_step_in_x::value); + static_assert(view_is_step_in_x::value, ""); + static_assert(view_is_step_in_x::value, ""); + static_assert(!view_is_step_in_x::value, ""); - BOOST_STATIC_ASSERT(!is_planar::value); - BOOST_STATIC_ASSERT(is_planar::value); - BOOST_STATIC_ASSERT(is_planar::value); + static_assert(!is_planar::value, ""); + static_assert(is_planar::value, ""); + static_assert(is_planar::value, ""); - BOOST_STATIC_ASSERT(view_is_mutable::value); - BOOST_STATIC_ASSERT(!view_is_mutable::value); - BOOST_STATIC_ASSERT(view_is_mutable::value); + static_assert(view_is_mutable::value, ""); + static_assert(!view_is_mutable::value, ""); + static_assert(view_is_mutable::value, ""); - BOOST_STATIC_ASSERT((boost::is_same::type, cmyk8c_planar_step_view_t>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, rgb16c_planar_step_view_t>::value)); - BOOST_STATIC_ASSERT((boost::is_same::type, rgb8c_step_view_t>::value)); + static_assert(boost::is_same::type, cmyk8c_planar_step_view_t>::value, ""); + static_assert(boost::is_same::type, rgb16c_planar_step_view_t>::value, ""); + static_assert(boost::is_same::type, rgb8c_step_view_t>::value, ""); // test view get raw data (mostly compile-time test) { diff --git a/test/pixel.cpp b/test/pixel.cpp index 2f8317bcca..0b82db7662 100644 --- a/test/pixel.cpp +++ b/test/pixel.cpp @@ -241,7 +241,7 @@ void test_packed_pixel() using rgb565_pixel_t = packed_pixel_type, rgb_layout_t>::type; boost::function_requires >(); - BOOST_STATIC_ASSERT((sizeof(rgb565_pixel_t)==2)); + static_assert(sizeof(rgb565_pixel_t) == 2, ""); // define a bgr556 pixel using bgr556_pixel_t = packed_pixel_type, bgr_layout_t>::type; @@ -273,24 +273,24 @@ void test_packed_pixel() do_basic_test, reference_core >(p121).test_heterogeneous(); do_basic_test, reference_core >(p121).test_heterogeneous(); - BOOST_STATIC_ASSERT((pixel_reference_is_proxy::value)); - BOOST_STATIC_ASSERT((pixel_reference_is_proxy::value)); + static_assert(pixel_reference_is_proxy::value, ""); + static_assert(pixel_reference_is_proxy::value, ""); - BOOST_STATIC_ASSERT(!(pixel_reference_is_proxy::value)); - BOOST_STATIC_ASSERT(!(pixel_reference_is_proxy::value)); - BOOST_STATIC_ASSERT(!(pixel_reference_is_proxy::value)); + static_assert(!pixel_reference_is_proxy::value, ""); + static_assert(!pixel_reference_is_proxy::value, ""); + static_assert(!pixel_reference_is_proxy::value, ""); - BOOST_STATIC_ASSERT( (pixel_reference_is_mutable< rgb8_pixel_t&>::value)); - BOOST_STATIC_ASSERT(!(pixel_reference_is_mutable::value)); + static_assert(pixel_reference_is_mutable::value, ""); + static_assert(!pixel_reference_is_mutable::value, ""); - BOOST_STATIC_ASSERT((pixel_reference_is_mutable::value)); - BOOST_STATIC_ASSERT((pixel_reference_is_mutable< rgb8_planar_ref_t >::value)); + static_assert(pixel_reference_is_mutable::value, ""); + static_assert(pixel_reference_is_mutable::value, ""); - BOOST_STATIC_ASSERT(!(pixel_reference_is_mutable::value)); - BOOST_STATIC_ASSERT(!(pixel_reference_is_mutable< rgb8c_planar_ref_t >::value)); + static_assert(!pixel_reference_is_mutable::value, ""); + static_assert(!pixel_reference_is_mutable::value, ""); - BOOST_STATIC_ASSERT( (pixel_reference_is_mutable::value)); - BOOST_STATIC_ASSERT(!(pixel_reference_is_mutable::value)); + static_assert(pixel_reference_is_mutable::value, ""); + static_assert(!pixel_reference_is_mutable::value, ""); } diff --git a/test/pixel_iterator.cpp b/test/pixel_iterator.cpp index dbb2516b4b..9fd54ab3b8 100644 --- a/test/pixel_iterator.cpp +++ b/test/pixel_iterator.cpp @@ -49,15 +49,15 @@ void test_pixel_iterator() boost::function_requires >(); // TEST dynamic_step_t - BOOST_STATIC_ASSERT(( boost::is_same::type>::value )); - BOOST_STATIC_ASSERT(( boost::is_same::type>::value )); + static_assert(boost::is_same::type>::value, ""); + static_assert(boost::is_same::type>::value, ""); - BOOST_STATIC_ASSERT(( boost::is_same::type,gray8c_ptr_t>::value )); + static_assert(boost::is_same::type,gray8c_ptr_t>::value, ""); // TEST iterator_is_step - BOOST_STATIC_ASSERT(iterator_is_step< cmyk16_step_ptr_t >::value); - BOOST_STATIC_ASSERT(iterator_is_step< cmyk16_planar_step_ptr_t >::value); - BOOST_STATIC_ASSERT(!iterator_is_step< cmyk16_planar_ptr_t >::value); + static_assert(iterator_is_step::value, ""); + static_assert(iterator_is_step::value, ""); + static_assert(!iterator_is_step::value, ""); using ccv_rgb_g_fn = color_convert_deref_fn; using ccv_g_rgb_fn = color_convert_deref_fn; @@ -65,20 +65,20 @@ void test_pixel_iterator() gil_function_requires > >(); using rgb2gray_ptr = dereference_iterator_adaptor; - BOOST_STATIC_ASSERT(!iterator_is_step< rgb2gray_ptr >::value); + static_assert(!iterator_is_step::value, ""); using rgb2gray_step_ptr = dynamic_x_step_type::type; - BOOST_STATIC_ASSERT(( boost::is_same< rgb2gray_step_ptr, dereference_iterator_adaptor >::value)); + static_assert(boost::is_same>::value, ""); make_step_iterator(rgb2gray_ptr(),2); using rgb2gray_step_ptr1 = dereference_iterator_adaptor; - BOOST_STATIC_ASSERT(iterator_is_step< rgb2gray_step_ptr1 >::value); - BOOST_STATIC_ASSERT(( boost::is_same< rgb2gray_step_ptr1, dynamic_x_step_type::type >::value)); + static_assert(iterator_is_step::value, ""); + static_assert(boost::is_same::type>::value, ""); using rgb2gray_step_ptr2 = memory_based_step_iterator>; - BOOST_STATIC_ASSERT(iterator_is_step< rgb2gray_step_ptr2 >::value); - BOOST_STATIC_ASSERT(( boost::is_same< rgb2gray_step_ptr2, dynamic_x_step_type::type >::value)); + static_assert(iterator_is_step::value, ""); + static_assert(boost::is_same::type>::value, ""); make_step_iterator(rgb2gray_step_ptr2(),2); // bit_aligned iterators test @@ -97,7 +97,7 @@ void test_pixel_iterator() // BGR232 pixel value. It is a packed_pixel of size 1 byte. (The last bit is unused) using bgr232_pixel_t = std::iterator_traits::value_type; - BOOST_STATIC_ASSERT((sizeof(bgr232_pixel_t)==1)); + static_assert(sizeof(bgr232_pixel_t) == 1, ""); bgr232_pixel_t red(0,0,3); // = 0RRGGGBB, = 01100000 diff --git a/toolbox/test/channel_type.cpp b/toolbox/test/channel_type.cpp index a306e29b8e..d10e23694c 100644 --- a/toolbox/test/channel_type.cpp +++ b/toolbox/test/channel_type.cpp @@ -17,11 +17,10 @@ BOOST_AUTO_TEST_SUITE( toolbox_tests ) BOOST_AUTO_TEST_CASE( channel_type_test ) { - BOOST_STATIC_ASSERT(( is_same< unsigned char, channel_type< rgb8_pixel_t >::type >::value )); + static_assert(is_same::type>::value, ""); // float32_t is a scoped_channel_value object - BOOST_STATIC_ASSERT(( - is_same::type>::value)); + static_assert(is_same::type>::value, ""); // channel_type for bit_aligned images doesn't work with standard gil. using image_t = bit_aligned_image4_type<4, 4, 4, 4, rgb_layout_t>::type; diff --git a/toolbox/test/channel_view.cpp b/toolbox/test/channel_view.cpp index 808191a65a..4512050541 100644 --- a/toolbox/test/channel_view.cpp +++ b/toolbox/test/channel_view.cpp @@ -28,10 +28,11 @@ BOOST_AUTO_TEST_CASE( channel_view_test ) using channel_view_t = channel_view_type::type; channel_view_t red_ = channel_view< red_t >( const_view( img )); - BOOST_STATIC_ASSERT(( is_same< kth_channel_view_type< 0, const rgb8_view_t>::type - , channel_view_type< red_t, const rgb8_view_t>::type - >::value - )); + static_assert(is_same + < + kth_channel_view_type<0, rgb8_view_t const>::type, + channel_view_type::type + >::value, ""); } BOOST_AUTO_TEST_SUITE_END() diff --git a/toolbox/test/get_num_bits.cpp b/toolbox/test/get_num_bits.cpp index 2f227babb1..3699cef443 100644 --- a/toolbox/test/get_num_bits.cpp +++ b/toolbox/test/get_num_bits.cpp @@ -22,20 +22,20 @@ BOOST_AUTO_TEST_CASE( get_num_bits_test ) using image_t = bit_aligned_image4_type<4, 4, 4, 4, rgb_layout_t>::type; using channel_t = channel_type::type; - BOOST_STATIC_ASSERT( get_num_bits< channel_t >::value == 4 ); + static_assert(get_num_bits::value == 4, ""); using const_channel_t = channel_type::type; - BOOST_STATIC_ASSERT( get_num_bits< const_channel_t >::value == 4 ); + static_assert(get_num_bits::value == 4, ""); using bits_t = packed_channel_value<23>; - BOOST_STATIC_ASSERT( get_num_bits< bits_t >::value == 23 ); - BOOST_STATIC_ASSERT( get_num_bits< const bits_t >::value == 23 ); + static_assert(get_num_bits::value == 23, ""); + static_assert(get_num_bits::value == 23, ""); - BOOST_STATIC_ASSERT( get_num_bits< unsigned char >::value == 8 ); - BOOST_STATIC_ASSERT( get_num_bits< const unsigned char >::value == 8 ); + static_assert(get_num_bits::value == 8, ""); + static_assert(get_num_bits::value == 8, ""); - BOOST_STATIC_ASSERT( get_num_bits< channel_type< gray8_image_t::view_t::value_type >::type >::value == 8 ); - BOOST_STATIC_ASSERT( get_num_bits< channel_type< rgba32_image_t::view_t::value_type >::type >::value == 32 ); + static_assert(get_num_bits::type>::value == 8, ""); + static_assert(get_num_bits::type>::value == 32, ""); } BOOST_AUTO_TEST_SUITE_END() diff --git a/toolbox/test/get_pixel_type.cpp b/toolbox/test/get_pixel_type.cpp index 0804e80415..0a7bf232c4 100644 --- a/toolbox/test/get_pixel_type.cpp +++ b/toolbox/test/get_pixel_type.cpp @@ -20,18 +20,20 @@ BOOST_AUTO_TEST_CASE( get_pixel_type_test ) { { using image_t = bit_aligned_image3_type<4, 15, 4, rgb_layout_t>::type; - BOOST_STATIC_ASSERT(( is_same< get_pixel_type< image_t::view_t >::type - , image_t::view_t::reference - >::value - )); + static_assert(is_same + < + get_pixel_type::type, + image_t::view_t::reference + >::value, ""); } { using image_t = rgb8_image_t; - BOOST_STATIC_ASSERT(( is_same< get_pixel_type< image_t::view_t >::type - , image_t::view_t::value_type - >::value - )); + static_assert(is_same + < + get_pixel_type::type, + image_t::view_t::value_type + >::value, ""); } } diff --git a/toolbox/test/is_bit_aligned.cpp b/toolbox/test/is_bit_aligned.cpp index 749a9160c5..b1185954bd 100644 --- a/toolbox/test/is_bit_aligned.cpp +++ b/toolbox/test/is_bit_aligned.cpp @@ -19,7 +19,7 @@ BOOST_AUTO_TEST_SUITE( toolbox_tests ) BOOST_AUTO_TEST_CASE( is_bit_aligned_test ) { using image_t = bit_aligned_image1_type< 4, gray_layout_t>::type; - BOOST_STATIC_ASSERT(( is_bit_aligned< image_t::view_t::value_type >::value )); + static_assert(is_bit_aligned::value, ""); } BOOST_AUTO_TEST_SUITE_END() diff --git a/toolbox/test/is_homogeneous.cpp b/toolbox/test/is_homogeneous.cpp index a79c1d03b8..0e3dd5dee1 100644 --- a/toolbox/test/is_homogeneous.cpp +++ b/toolbox/test/is_homogeneous.cpp @@ -17,12 +17,12 @@ BOOST_AUTO_TEST_SUITE( toolbox_tests ) BOOST_AUTO_TEST_CASE( is_homogeneous_test ) { - BOOST_STATIC_ASSERT(( is_homogeneous< rgb8_pixel_t >::value )); + static_assert(is_homogeneous::value, ""); - BOOST_STATIC_ASSERT(( is_homogeneous< cmyk16c_planar_ref_t >::value )); + static_assert(is_homogeneous::value, ""); using image_t = bit_aligned_image1_type< 4, gray_layout_t>::type; - BOOST_STATIC_ASSERT(( is_homogeneous< image_t::view_t::reference >::value )); + static_assert(is_homogeneous::value, ""); } BOOST_AUTO_TEST_SUITE_END() diff --git a/toolbox/test/pixel_bit_size.cpp b/toolbox/test/pixel_bit_size.cpp index f7fdcfea5d..0308a73666 100644 --- a/toolbox/test/pixel_bit_size.cpp +++ b/toolbox/test/pixel_bit_size.cpp @@ -21,7 +21,7 @@ BOOST_AUTO_TEST_CASE( pixel_bit_size_test ) < 16, 16, 16, 8, 8, devicen_layout_t<5> >::type; - BOOST_STATIC_ASSERT(( pixel_bit_size::value == 64 )); + static_assert(pixel_bit_size::value == 64, ""); } BOOST_AUTO_TEST_SUITE_END() diff --git a/toolbox/test/subchroma_image.cpp b/toolbox/test/subchroma_image.cpp index 6c6afc9c0f..541002ca2b 100644 --- a/toolbox/test/subchroma_image.cpp +++ b/toolbox/test/subchroma_image.cpp @@ -57,12 +57,18 @@ BOOST_AUTO_TEST_CASE( subchroma_image_test ) { using pixel_t = rgb8_pixel_t; - subchroma_image< pixel_t, mpl::vector_c< int, 4, 4, 4 > > a( 640, 480 ); BOOST_STATIC_ASSERT(( a.ss_X == 1 && a.ss_Y == 1 )); - subchroma_image< pixel_t, mpl::vector_c< int, 4, 4, 0 > > b( 640, 480 ); BOOST_STATIC_ASSERT(( b.ss_X == 1 && b.ss_Y == 2 )); - subchroma_image< pixel_t, mpl::vector_c< int, 4, 2, 2 > > c( 640, 480 ); BOOST_STATIC_ASSERT(( c.ss_X == 2 && c.ss_Y == 1 )); - subchroma_image< pixel_t, mpl::vector_c< int, 4, 2, 0 > > d( 640, 480 ); BOOST_STATIC_ASSERT(( d.ss_X == 2 && d.ss_Y == 2 )); - subchroma_image< pixel_t, mpl::vector_c< int, 4, 1, 1 > > e( 640, 480 ); BOOST_STATIC_ASSERT(( e.ss_X == 4 && e.ss_Y == 1 )); - subchroma_image< pixel_t, mpl::vector_c< int, 4, 1, 0 > > f( 640, 480 ); BOOST_STATIC_ASSERT(( f.ss_X == 4 && f.ss_Y == 2 )); + subchroma_image> a(640, 480); + static_assert(a.ss_X == 1 && a.ss_Y == 1, ""); + subchroma_image> b(640, 480); + static_assert(b.ss_X == 1 && b.ss_Y == 2, ""); + subchroma_image> c(640, 480); + static_assert(c.ss_X == 2 && c.ss_Y == 1, ""); + subchroma_image> d(640, 480); + static_assert(d.ss_X == 2 && d.ss_Y == 2, ""); + subchroma_image> e(640, 480); + static_assert(e.ss_X == 4 && e.ss_Y == 1, ""); + subchroma_image> f(640, 480); + static_assert(f.ss_X == 4 && f.ss_Y == 2, ""); fill_pixels( view( a ), pixel_t( 10, 20, 30 ) ); fill_pixels( view( b ), pixel_t( 10, 20, 30 ) );