MCPcopy Create free account
hub / github.com/ShiqiYu/CPP / MyVector

Class MyVector

week13/examples/specialization.cpp:6–23  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4// Class Template
5template<typename T>
6class MyVector
7{
8 size_t length;
9 T * data;
10 public:
11 MyVector(size_t length): length(length)
12 {
13 data = new T[length]{};
14 }
15 ~MyVector()
16 {
17 delete [] data;
18 }
19 MyVector(const MyVector&) = delete;
20 MyVector& operator=(const MyVector&) = delete;
21 T getElement(size_t index);
22 bool setElement(size_t index, T value);
23};
24template <typename T>
25T MyVector<T>::getElement(size_t index)
26{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected