Skip to content
Snippets Groups Projects
Commit f2bc3a37 authored by Edward Moyse's avatar Edward Moyse
Browse files

Merge branch 'AlignedDynArray_typos' into 'master'

AlignedDynArray: fix typo, comments, copyright

See merge request atlas/athena!34720
parents 86c30f97 8be9048f
No related branches found
No related tags found
No related merge requests found
...@@ -13,12 +13,12 @@ ...@@ -13,12 +13,12 @@
#include <cstdlib> #include <cstdlib>
#include <memory> #include <memory>
namespace GSFUtils { namespace GSFUtils {
/* /*
* GCC and Clang provide) the the attribute * Use GCC and Clang attributes to express that we return aligned ouputs
* if we have a std implementing ideas from * If we have a std implementing ideas from
* http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0886r0.pdf * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0886r0.pdf
* prb we do not need this * prb we do not need this.
* Can be used to express that we return aligned ouputs
*/ */
#if defined(__GNUC__) && !defined(__CLING__) && !defined(__ICC) #if defined(__GNUC__) && !defined(__CLING__) && !defined(__ICC)
#define GSF_ALIGN_RETURN(X) __attribute__((assume_aligned(X))) #define GSF_ALIGN_RETURN(X) __attribute__((assume_aligned(X)))
...@@ -53,32 +53,41 @@ struct AlignedDynArray ...@@ -53,32 +53,41 @@ struct AlignedDynArray
typedef std::size_t size_type; typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
/// @} /// @}
/// Deleted default constructor /// Deleted default constructor
AlignedDynArray() = delete; AlignedDynArray() = delete;
/// Deleted default copy constructor /// Deleted default copy constructor
AlignedDynArray(AlignedDynArray const&) = delete; AlignedDynArray(AlignedDynArray const&) = delete;
/// Deleted default assignment operator /// Deleted default assignment operator
AlignedDynArray& operator=(AlignedDynArray const&) = delete; AlignedDynArray& operator=(AlignedDynArray const&) = delete;
/// Constructor default initializing elements /// Constructor with default initializing elements
explicit AlignedDynArray(size_type n); explicit AlignedDynArray(size_type n);
/// Constructor initializing elements to value /// Constructor initializing elements to value
explicit AlignedDynArray(size_type n, const T& value); explicit AlignedDynArray(size_type n, const T& value);
/// Move copy constructor /// Move copy constructor
AlignedDynArray(AlignedDynArray&&) noexcept; AlignedDynArray(AlignedDynArray&&) noexcept;
/// Move assignment operator /// Move assignment operator
AlignedDynArray& operator=(AlignedDynArray&&) noexcept; AlignedDynArray& operator=(AlignedDynArray&&) noexcept;
/// Destructor /// Destructor
~AlignedDynArray(); ~AlignedDynArray();
/// Get the underlying buffer /// Get the underlying buffer
pointer buffer() noexcept GSF_ALIGN_RETURN(ALIGNMENT); pointer buffer() noexcept GSF_ALIGN_RETURN(ALIGNMENT);
/// Get the underlying buffer
/// Get the underlying buffer (const)
const_pointer buffer() const noexcept GSF_ALIGN_RETURN(ALIGNMENT); const_pointer buffer() const noexcept GSF_ALIGN_RETURN(ALIGNMENT);
/// index array operators /// index array operator
reference operator[](size_type pos) noexcept; reference operator[](size_type pos) noexcept;
/// index array operator (const)
const_reference operator[](size_type pos) const noexcept; const_reference operator[](size_type pos) const noexcept;
/// iterator pointing to the first element /// iterator pointing to the first element
...@@ -101,8 +110,13 @@ struct AlignedDynArray ...@@ -101,8 +110,13 @@ struct AlignedDynArray
private: private:
/// Helper method for calling the dtor for the elements
void cleanup(); void cleanup();
///Pointer to the underlying buffer
pointer m_buffer = nullptr; pointer m_buffer = nullptr;
///Num of elements/size
size_type m_size = 0; size_type m_size = 0;
}; };
......
/* /*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
/** /**
......
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