dash icon indicating copy to clipboard operation
dash copied to clipboard

resize in TeamSpec is ambiguous in case of two dimensions

Open dhinf opened this issue 6 years ago • 3 comments

The method resize (TeamSpec) is ambiguous in case of two dimensions:

template<typename... Args> void resize(SizeType arg, Args... args) vs. void resize(dim_t dim, SizeType extent)

e.g. the call teamspec.resize(2,1) doesn't compile. Currently, I don't have a solution, in case we want to keep both functionalities.

dhinf avatar Jan 25 '19 15:01 dhinf

Maybe rename resize(dim_t...) to resize_dim(dim_t,...)

dhinf avatar Jan 25 '19 15:01 dhinf

I'm fine with renaming resize(dim_t, SizeType) to resize_dim(...).

devreal avatar Jan 25 '19 16:01 devreal

It should be:

resize(dim_t, d, SizeType extent);
resize(std::initializer_list<SizeType> extents);

The reason using the same name (overload) was the 1-dimensional case in particular.

TeamSpec<1> ts(16);
ts.resize(0, // Elementary, dear Watson!
             8);

Another thing: We might also want resize<dim_t>(SizeType> to ensure compile-time definition of the dimension. Nowadays, constexpr achieves the same when used correctly, but it doesn't complain if we don't.

fuchsto avatar Mar 09 '19 19:03 fuchsto