-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVector.h
More file actions
45 lines (34 loc) · 1.37 KB
/
Vector.h
File metadata and controls
45 lines (34 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef ECS_36B_HOMEWORK_VECTOR_H
#define ECS_36B_HOMEWORK_VECTOR_H
#include <vector>
#include "BaseVector.h"
#include "ConstBaseVector.h"
namespace Matrix {
class Vector : public BaseVector{
public:
//create a vector that contains the same elements as in orig
explicit Vector(const ConstBaseVector& orig);
//create a vector that holds numElements and each element is value
Vector(int numElements, const BaseVector::value_type& value);
//create a vector that holds numElements 0's
explicit Vector(int numElements);
//create a vector that contains the specified values
explicit Vector(const std::vector<value_type>& values);
//create a 1 X 1 vector with the value 0
Vector();
virtual ~Vector() override = default;
//make all of the elements in this vector the same
//as what is in rhs. adjust the size of this vector if necessary
Vector& operator=(const ConstBaseVector& rhs);
//return the number of elements in the Vector
virtual int size() const override;
//return the element at the position
virtual value_type& at(int index) override;
virtual const value_type& at(int index) const override;
virtual value_type& operator[](int index) override;
virtual const value_type& operator[](int index) const override;
private:
std::vector<value_type> rawVector;
};
}
#endif //ECS_36B_HOMEWORK_VECTOR_H