MCPcopy Create free account
hub / github.com/Snapchat/Valdi / ValueArrayBuilder

Class ValueArrayBuilder

valdi_core/src/valdi_core/cpp/Utils/ValueArrayBuilder.hpp:15–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13namespace Valdi {
14
15class ValueArrayBuilder {
16public:
17 ValueArrayBuilder();
18 ValueArrayBuilder(const ValueArrayBuilder& other);
19
20 void prepend(Value&& value);
21 void append(Value&& value);
22 void append(const Value& value);
23 void remove(size_t index);
24 void clear();
25
26 void reserve(size_t size);
27
28 template<typename T>
29 void emplace(T&& value) {
30 append(Value(std::forward<T>(value)));
31 }
32
33 const Value* begin() const;
34 const Value* end() const;
35
36 ValueArrayBuilder& operator=(const ValueArrayBuilder& other);
37
38 const Value& operator[](size_t i) const;
39
40 size_t size() const;
41 size_t capacity() const;
42 bool empty() const;
43
44 Ref<ValueArray> build() const;
45
46private:
47 Ref<ValueArray> _buffer;
48 size_t _size = 0;
49};
50
51} // namespace Valdi

Calls

no outgoing calls

Tested by 2

TEST_PFunction · 0.68
TEST_PFunction · 0.68