From c95eb57d3f43bf1ad19af79c463a5991a0bd7f6d Mon Sep 17 00:00:00 2001 From: Anna Gringauze Date: Thu, 19 Nov 2015 12:02:06 -0800 Subject: [PATCH] Fixed conversion problem when creating strided_span from span and bounds --- include/span.h | 8 ++++++-- tests/span_tests.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/include/span.h b/include/span.h index dcce344..74a5e11 100644 --- a/include/span.h +++ b/include/span.h @@ -1610,8 +1610,12 @@ public: {} // from array view - template > - constexpr strided_span(span av, bounds_type bounds) : strided_span(av.data(), av.bounds().total_size(), std::move(bounds)) + template ::value, + typename Dummy = std::enable_if_t + > + constexpr strided_span(span av, bounds_type bounds) : strided_span(av.data(), av.bounds().total_size(), std::move(bounds)) {} // convertible diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp index 8a7c552..a78fe6e 100644 --- a/tests/span_tests.cpp +++ b/tests/span_tests.cpp @@ -333,7 +333,7 @@ SUITE(span_tests) CHECK(sav_c[1] == 2); #if _MSC_VER > 1800 - strided_span sav_v{ {src}, {2, 1} }; + strided_span sav_v{ src, {2, 1} }; #else strided_span sav_v{ span{src}, strided_bounds<1>{2, 1} }; #endif @@ -342,7 +342,7 @@ SUITE(span_tests) CHECK(sav_v[1] == 2); #if _MSC_VER > 1800 - strided_span sav_cv{ {src}, {2, 1} }; + strided_span sav_cv{ src, {2, 1} }; #else strided_span sav_cv{ span{src}, strided_bounds<1>{2, 1} }; #endif @@ -361,7 +361,7 @@ SUITE(span_tests) CHECK(sav_c[1] == 2); #if _MSC_VER > 1800 - strided_span sav_cv{ {src}, {2, 1} }; + strided_span sav_cv{ src, {2, 1} }; #else strided_span sav_cv{ span{src}, strided_bounds<1>{2, 1} }; #endif @@ -381,7 +381,7 @@ SUITE(span_tests) CHECK(sav_v[1] == 2); #if _MSC_VER > 1800 - strided_span sav_cv{ {src}, {2, 1} }; + strided_span sav_cv{ src, {2, 1} }; #else strided_span sav_cv{ span{src}, strided_bounds<1>{2, 1} }; #endif