3#include <ossia/detail/ptr_set.hpp>
13 safe_vector() {
static_assert(
sizeof(T) <= 64,
"use this only for small types"); }
15 safe_vector(
const safe_vector&) =
delete;
16 safe_vector(safe_vector&&) noexcept = default;
17 safe_vector& operator=(const safe_vector&) = delete;
18 safe_vector& operator=(safe_vector&&) noexcept = default;
20 bool contains(T t) noexcept {
return ossia::contains(impl, t); }
22 void clear() noexcept { impl.clear(); }
24 void push_back(T t) { impl.push_back(t); }
26 [[nodiscard]]
bool empty() const noexcept {
return impl.empty(); }
28 void remove_all(T t) { ossia::remove_erase(impl, t); }
30 void reserve(std::size_t N) { impl.reserve(N); }
32 auto size()
const {
return impl.size(); }
34 auto copy()
const {
return impl; }
36 auto& reference() noexcept {
return impl; }
38 auto& reference() const noexcept {
return impl; }
48 static_assert(
sizeof(T) <= 64,
"use this only for small types");
50 safe_set(
const safe_set&) =
default;
51 safe_set(safe_set&&) noexcept = default;
52 safe_set& operator=(const safe_set&) = default;
53 safe_set& operator=(safe_set&&) noexcept = default;
55 bool contains(T t) {
return ossia::contains(impl, t); }
57 void clear() { impl.clear(); }
59 void push_back(T t) { impl.insert(t); }
61 void remove_all(T t) { impl.erase(t); }
63 void reserve(std::size_t N) { impl.reserve(N); }
65 auto copy()
const {
return impl; }
67 auto& reference() {
return impl; }
69 auto& reference()
const {
return impl; }
71 auto size()
const {
return impl.size(); }
73 auto empty()
const {
return impl.empty(); }
75 auto begin()
const {
return impl.begin(); }
77 auto end()
const {
return impl.end(); }
80 ossia::ptr_set<T> impl;