no index synchronization in (const)operation class; directly use pos arg (makes some things thread save)

This commit is contained in:
Christian Zimmermann 2019-07-12 12:45:41 +02:00
parent b79f010c87
commit 015734fa16

View file

@ -244,16 +244,18 @@ namespace MultiArrayTools
template <class ET> template <class ET>
inline ConstOperationRoot<T,Ranges...>& ConstOperationRoot<T,Ranges...>::set(ET pos) inline ConstOperationRoot<T,Ranges...>& ConstOperationRoot<T,Ranges...>::set(ET pos)
{ {
mIndex = pos.val(); //mIndex = pos.val();
mDataPtr = mOrigDataPtr + mIndex.pos(); //mDataPtr = mOrigDataPtr + mIndex.pos();
mDataPtr = mOrigDataPtr + pos.val();
return *this; return *this;
} }
template <typename T, class... Ranges> template <typename T, class... Ranges>
const T* ConstOperationRoot<T,Ranges...>::data() const const T* ConstOperationRoot<T,Ranges...>::data() const
{ {
auto i = mIndex; //auto i = mIndex;
return mOrigDataPtr + i().pos(); //return mOrigDataPtr/* + i().pos()*/;
return mDataPtr;
} }
template <typename T, class... Ranges> template <typename T, class... Ranges>
@ -457,8 +459,9 @@ namespace MultiArrayTools
template <class ET> template <class ET>
inline OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::set(ET pos) inline OperationRoot<T,Ranges...>& OperationRoot<T,Ranges...>::set(ET pos)
{ {
mIndex = pos.val(); //mIndex = pos.val();
mDataPtr = mOrigDataPtr + mIndex.pos(); //mDataPtr = mOrigDataPtr + mIndex.pos();
mDataPtr = mOrigDataPtr + pos.val();
return *this; return *this;
} }
@ -478,8 +481,9 @@ namespace MultiArrayTools
template <typename T, class... Ranges> template <typename T, class... Ranges>
T* OperationRoot<T,Ranges...>::data() const T* OperationRoot<T,Ranges...>::data() const
{ {
auto i = mIndex; //auto i = mIndex;
return mOrigDataPtr + i().pos(); //return mOrigDataPtr/* + i().pos()*/;
return mDataPtr;
} }
template <typename T, class... Ranges> template <typename T, class... Ranges>