Skip to content
Snippets Groups Projects
Commit e9ebe87f authored by Scott Snyder's avatar Scott Snyder Committed by Walter Lampl
Browse files

CxxUtils: Fix thread-safety checker warnings.

CxxUtils: Fix thread-safety checker warnings.

Fix some new thread-safety checker warnings.
parent 8739616f
No related branches found
No related tags found
No related merge requests found
......@@ -46,9 +46,11 @@
namespace CxxUtils {
// Forward declaration.
// Forward declarations.
template <unsigned int N>
class ArrayIterator;
template <unsigned int N>
class WritableArray;
//**********************************************************************
......@@ -245,6 +247,7 @@ protected:
// These classes need to call the above protected constructor.
friend class Array<N+1>;
friend WritableArray<N+1>;
friend class ArrayIterator<N+1>;
/// Pointer to the representation.
......@@ -358,6 +361,7 @@ protected:
// This class needs to call the above protected constructor.
friend class Array<1>;
friend class WritableArray<1>;
/// Pointer to this array's single element.
/// Null if this instance was created using the default constructor.
......@@ -663,7 +667,17 @@ public:
*
* Note that this operation is not available if @c N is 0.
*/
WritableArray<N-1> operator[] (unsigned int i) const;
WritableArray<N-1> operator[] (unsigned int i);
/**
* @brief Array indexing.
* @param i The desired index. Must be less than the array size
* along this dimension.
* @return The @a i'th @c N-1 dimensional subarray in the array.
*
* Note that this operation is not available if @c N is 0.
*/
Array<N-1> operator[] (unsigned int i) const;
/**
* @brief Return a direct pointer to array elements.
......
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
/**
......@@ -709,7 +709,7 @@ WritableArray<N>::WritableArray (Arrayrep& rep)
*/
template <unsigned int N>
inline
WritableArray<N-1> WritableArray<N>::operator[] (unsigned int i) const
WritableArray<N-1> WritableArray<N>::operator[] (unsigned int i)
{
assert (i < this->m_rep_nc->m_shape[this->m_rep_nc->m_shape.size() - N]);
return WritableArray<N-1> (*this->m_rep_nc,
......@@ -717,6 +717,24 @@ WritableArray<N-1> WritableArray<N>::operator[] (unsigned int i) const
}
/**
* @brief Array indexing.
* @param i The desired index. Must be less than the array size
* along this dimension.
* @return The @a i'th @c N-1 dimensional subarray in the array.
*
* Note that this operation is not available if @c N is 0.
*/
template <unsigned int N>
inline
Array<N-1> WritableArray<N>::operator[] (unsigned int i) const
{
assert (i < this->m_rep_nc->m_shape[this->m_rep_nc->m_shape.size() - N]);
return Array<N-1> (*this->m_rep_nc,
this->m_offs + i * this->m_rep_nc->m_sizes[N-1]);
}
/**
* @brief Return a direct pointer to array elements.
* @return A pointer to the first array elements.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment