From 8424a294a62ca4802bd61b6c38de37813d03da07 Mon Sep 17 00:00:00 2001 From: Khouri Giordano Date: Tue, 17 May 2016 15:34:49 -0400 Subject: [PATCH] Ctor now explicit, has const argument --- test/generator/image_from_array_aottest.cpp | 2 +- tools/halide_image.h | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/generator/image_from_array_aottest.cpp b/test/generator/image_from_array_aottest.cpp index 929723b3be50..2b30d8d4b3d9 100644 --- a/test/generator/image_from_array_aottest.cpp +++ b/test/generator/image_from_array_aottest.cpp @@ -152,7 +152,7 @@ void verify_image_construction_from_array(Array &vals) { n *= dimSizes[i]; } T const *reference = first_of_array(vals); - T *under_test = img.data(); + T const *under_test = img.data(); for (int i = 0; i < n; ++i) { if (under_test[i] == reference[i]) continue; diff --git a/tools/halide_image.h b/tools/halide_image.h index fc6af6a454aa..5160e8b96588 100644 --- a/tools/halide_image.h +++ b/tools/halide_image.h @@ -174,10 +174,11 @@ class Image { } // Initialize the Image from a statically sized array. - // Because of the scalar overload of dimension_sizes, this will only work if Array + // The data will be copied to internal storage. + // Because of the scalar overload of dimension_sizes, this will only work if vals // is T or T const of one or more dimensions. - template< typename Array, size_t N > - Image(Array (&vals)[N]) { + template + explicit Image(Array const (&vals)[N]) { std::vector dimSizes(dimension_sizes(vals)); size_t dims = dimSizes.size(); assert(dims <= 4);