From 8d38f1d258303f7bce3d3601b084df7d6ec81dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 12 Sep 2016 10:30:43 +0200 Subject: [PATCH] Add even more special case workarounds to deprecated build of ImageView. The test now compiles and passes again. --- src/Magnum/ImageView.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Magnum/ImageView.h b/src/Magnum/ImageView.h index 3775bbcee..bf26109ce 100644 --- a/src/Magnum/ImageView.h +++ b/src/Magnum/ImageView.h @@ -35,6 +35,10 @@ #include "Magnum/PixelStorage.h" #include "Magnum/Math/Vector4.h" +#ifdef MAGNUM_BUILD_DEPRECATED +#include +#endif + namespace Magnum { /** @@ -86,6 +90,10 @@ template class ImageView { explicit CORRADE_DEPRECATED("use ImageView(PixelFormat, PixelType, const VectorTypeFor&, Containers::ArrayView) instead") ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size, const void* data) noexcept: ImageView{{}, format, type, size, {reinterpret_cast(data), Implementation::imageDataSizeFor(format, type, size)}} {} #ifndef DOXYGEN_GENERATING_OUTPUT + /* To avoid ambiguous overload when passing ArrayView to the + constructor */ + template explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size, Containers::ArrayView data): ImageView{{}, format, type, size, Containers::ArrayView{data}} {} + template explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size, const Containers::Array& data): ImageView{{}, format, type, size, Containers::ArrayView(data)} {} /* To avoid decay of sized arrays and nullptr to const void* and unwanted use of deprecated function */ template explicit ImageView(PixelFormat format, PixelType type, const VectorTypeFor& size, const T(&data)[dataSize]): ImageView{{}, format, type, size, Containers::ArrayView{data}} {} @@ -169,6 +177,14 @@ template class ImageView { } #ifndef DOXYGEN_GENERATING_OUTPUT + /* To avoid ambiguous overload when passing ArrayView to the + function */ + template void setData(Containers::ArrayView data) { + setData(Containers::ArrayView{data}); + } + template void setData(const Containers::Array& data) { + setData(Containers::ArrayView(data)); + } /* To avoid decay of sized arrays and nullptr to const void* and unwanted use of deprecated function */ template void setData(const T(&data)[size]) {