Allow for non-const BinnedArrays. Remove not used BinnedArray0D
BinnedArray and the classes inheriting from it althought they were templated on T
actually could only work with const T
elements.
i.e they were declared as
template<class T>
class BinnedArray1D
....
BinnedArray1D(const std::vector<std::pair<SharedObject<const T>, Amg::Vector3D>>& tclassvector
.....
private:
std::vector<SharedObject<const T>>* m_array;
Note that the input and the private data member uses const T.
This is useful most of the times but there are cases one wants to "bin" non-const Ts and then manipulate them.
The above is changed to
template<class T>
class BinnedArray1DT
....
BinnedArray1DT(const std::vector<std::pair<SharedObject<T>, Amg::Vector3D>>& tclassvector
.....
private:
std::vector<SharedObject<T>>* m_array;
with
template <class T>
using BinnedArray1D = BinnedArray1DT<const T>;
i.e the BinnedArray1DT is can work for both const and non-const T. BinnedArray1D is an alias for when we want the const T case. Which is what we use today.
This could potentially allow usage of a BinnedArray1DT where applicable.
The end goal is to try to avoid certain mutable
or const cast
issues that stem
from having a set of originally non-const Ts passed to BinnedArray and then returned as const T.
mentioning @ssnyder
PS: BinnedArray0D had some obvious issues, but was not creating any problems as was not used so not - instantiated. Remove it for now.