MCPcopy Create free account
hub / github.com/Apress/beginning-cpp20 / Array

Class Array

Examples/NoModules/Chapter 17/Ex17_01/Array.h:13–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12template <typename T>
13class Array
14{
15public:
16 explicit Array(size_t size); // Constructor
17 ~Array(); // Destructor
18 Array(const Array& array); // Copy constructor
19 Array& operator=(const Array& rhs); // Copy assignment operator
20 T& operator[](size_t index); // Subscript operator
21 const T& operator[](size_t index) const; // Subscript operator-const arrays
22 size_t getSize() const { return m_size; } // Accessor for m_size
23
24private:
25 T* m_elements; // Array of type T
26 size_t m_size; // Number of array elements
27};
28
29// Constructor template
30template <typename T>

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected