Skip to content

Commit a7f1d8b

Browse files
committed
refactor: Remove unnecessary functionality from vectorn
Signed-off-by: Sietze van Buuren <s.van.buuren@gmail.com>
1 parent 73dc841 commit a7f1d8b

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

src/vectorn.hpp

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class VectorN {
6868
VectorN(const VectorN &other)
6969
: data_(other.data_),
7070
dimensions_(other.dimensions_),
71-
mdspan(std::mdspan(data_.data(), dimensions_)),
72-
current_index(0)
71+
mdspan(std::mdspan(data_.data(), dimensions_))
7372
{
7473
}
7574

@@ -88,10 +87,8 @@ class VectorN {
8887
{
8988
data_.reserve(calculate_total_size(dimensions));
9089
mdspan = std::mdspan(data_.data(), dimensions_);
91-
current_index = 0;
9290
}
9391

94-
9592
// Access elements using variadic indices
9693
template <typename... Indices>
9794
T& operator()(Indices... indices) {
@@ -117,21 +114,7 @@ class VectorN {
117114

118115
template <typename... Args>
119116
void emplace_back(Args... args) {
120-
if (current_index >= data_.capacity()) {
121-
throw std::out_of_range("Exceeded allocated size for VectorN");
122-
}
123117
data_.emplace_back(std::forward<Args>(args)...);
124-
current_index++;
125-
}
126-
127-
void reset_fill() {
128-
current_index = 0;
129-
}
130-
131-
void validate_fill_complete() const {
132-
if (current_index != data_.size()) {
133-
throw std::runtime_error("VectorN has not been completely filled");
134-
}
135118
}
136119

137120
Mdspan get_mdspan() {
@@ -142,7 +125,6 @@ class VectorN {
142125
return mdspan;
143126
}
144127

145-
// Extended method to return an mdspan with offset
146128
template <typename... Pairs>
147129
Mdspan submdspan(Pairs... pairs) const {
148130
return std::submdspan(mdspan, std::forward<Pairs>(pairs)...);
@@ -153,15 +135,13 @@ class VectorN {
153135
return std::submdspan(mdspan, std::forward<Pairs>(pairs)...);
154136
}
155137

156-
// Accessors
157138
const IndexArray& dimensions() const { return dimensions_; }
158139
const std::vector<T>& data() const { return data_; }
159140

160141
private:
161142
IndexArray dimensions_;
162143
std::vector<T> data_;
163144
Mdspan mdspan;
164-
std::size_t current_index = 0;
165145

166146
};
167147

0 commit comments

Comments
 (0)