blob: 091ecb912ec059ec1cb963a57993084874713284 (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
|
#pragma once
#include <mbgl/util/ignore.hpp>
#include <vector>
namespace mbgl {
namespace gfx {
template <class V>
class VertexVector {
public:
using Vertex = V;
template<typename Arg>
void emplace_back(Arg&& vertex) {
v.emplace_back(std::forward<Arg>(vertex));
}
void extend(std::size_t n, const Vertex& val) {
v.resize(v.size() + n, val);
}
Vertex& at(std::size_t n) {
assert(n < v.size());
return v.at(n);
}
std::size_t elements() const {
return v.size();
}
std::size_t bytes() const {
return v.size() * sizeof(Vertex);
}
bool empty() const {
return v.empty();
}
void clear() {
v.clear();
}
const Vertex* data() const {
return v.data();
}
const std::vector<Vertex>& vector() const {
return v;
}
private:
std::vector<Vertex> v;
};
} // namespace gfx
} // namespace mbgl
|