Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<typename T, std::size_t max_size_>
- class safe_static_vector {
- T arr_[max_size_];
- std::atomic<std::size_t> current_size_ = 0;
- public:
- T& operator[](std::size_t i) {
- return arr_[i];
- }
- void push_back(T t) {
- ++current_size;
- arr_[current_size_-1] = t;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment