diff --git a/include/oneapi/tbb/blocked_nd_range.h b/include/oneapi/tbb/blocked_nd_range.h index 66893032aa..0d499d54a4 100644 --- a/include/oneapi/tbb/blocked_nd_range.h +++ b/include/oneapi/tbb/blocked_nd_range.h @@ -151,7 +151,7 @@ class blocked_nd_range : public blocked_nd_range_impl { // blocked_nd_range(const dim_range_type& dim0, const dim_range_type& dim1, ...) // while the arguments are passed as braced-init-lists // Works only for 2 and more arguments since the deduction from -// single braced-init-list argument is ambiguous with the single C-array argument +// single braced-init-list or single C-array argument prefers the multi-dimensional range // Only braced-init-lists of size 2 and 3 are allowed since dim_range_type may only // be constructed from 2 or 3 arguments template , blocked_range...) -> blocked_nd_range; // blocked_nd_range(const value_type (&size)[N], size_type grainsize = 1) -// while the grainsize is not passed -// Does not work for arrays of size 2 or 3 since it is ambiguous with deducing -// for dim_range_type constructor taking the single braced-init-list -template > -blocked_nd_range(const Value (&)[N]) --> blocked_nd_range; - -// blocked_nd_range(const value_type (&size)[N], size_type grainsize = 1) -// while using the non-default grainsize template -blocked_nd_range(const Value (&)[N], typename blocked_nd_range::size_type) +blocked_nd_range(const Value (&)[N], typename blocked_nd_range::size_type = 1) -> blocked_nd_range; // blocked_nd_range(blocked_nd_range&, oneapi::tbb::split) diff --git a/test/tbb/test_blocked_range.cpp b/test/tbb/test_blocked_range.cpp index 4cbb506f2c..cd1636e7ce 100644 --- a/test/tbb/test_blocked_range.cpp +++ b/test/tbb/test_blocked_range.cpp @@ -244,6 +244,10 @@ void test_deduction_guides() { blocked_nd_range range({T{100}, T{200}}, 5); static_assert(std::is_same_v>); } + { + blocked_nd_range range({T{100}, T{200}}); + static_assert(std::is_same_v>); + } { T array[2] = {100, 200}; blocked_nd_range range(array, 5); @@ -253,6 +257,10 @@ void test_deduction_guides() { blocked_nd_range range({T{100}, T{200}, T{300}}, 5); static_assert(std::is_same_v>); } + { + blocked_nd_range range({T{100}, T{200}, T{300}}); + static_assert(std::is_same_v>); + } { T array[3] = {100, 200, 300}; blocked_nd_range range(array, 5);