mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Incorporation of comments from code review.
This commit is contained in:
parent
48a550aaf7
commit
02470bc630
8 changed files with 43 additions and 41 deletions
|
|
@ -4,7 +4,7 @@
|
|||
//! \file shared_array.h
|
||||
//! \brief Shared array data structure
|
||||
|
||||
#include<memory>
|
||||
#include <memory>
|
||||
|
||||
|
||||
namespace openmc {
|
||||
|
|
@ -24,14 +24,6 @@ namespace openmc {
|
|||
template <typename T>
|
||||
class SharedArray {
|
||||
|
||||
private:
|
||||
//==========================================================================
|
||||
// Data members
|
||||
|
||||
std::unique_ptr<T[]> data_; //!< A pointer to hold the data
|
||||
int64_t size_ {0}; //!< The current size of the SharedArray.
|
||||
int64_t capacity_ {0}; //!< The maximum capacity of the SharedArray.
|
||||
|
||||
public:
|
||||
//==========================================================================
|
||||
// Constructors
|
||||
|
|
@ -55,6 +47,7 @@ public:
|
|||
//! Return a reference to the element at specified location i. No bounds
|
||||
//! checking is performed.
|
||||
T& operator[](int64_t i) {return data_[i];}
|
||||
const T& operator[](int64_t i) const { return data_[i]; }
|
||||
|
||||
//! Allocate space in the container for the specified number of elements.
|
||||
//! reserve() does not change the size of the container.
|
||||
|
|
@ -116,6 +109,15 @@ public:
|
|||
|
||||
//! Return pointer to the underlying array serving as element storage.
|
||||
T* data() {return data_.get();}
|
||||
const T* data() const {return data_.get();}
|
||||
|
||||
private:
|
||||
//==========================================================================
|
||||
// Data members
|
||||
|
||||
std::unique_ptr<T[]> data_; //!< A pointer to hold the data
|
||||
int64_t size_ {0}; //!< The current size of the SharedArray.
|
||||
int64_t capacity_ {0}; //!< The maximum capacity of the SharedArray.
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue