Skip to content

Commit

Permalink
Ctor now explicit, has const argument
Browse files Browse the repository at this point in the history
  • Loading branch information
kgnk committed May 17, 2016
1 parent 818323b commit 8424a29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion test/generator/image_from_array_aottest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions tools/halide_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<typename Array, size_t N>
explicit Image(Array const (&vals)[N]) {
std::vector<int> dimSizes(dimension_sizes(vals));
size_t dims = dimSizes.size();
assert(dims <= 4);
Expand Down

0 comments on commit 8424a29

Please sign in to comment.