28concept Trivial = std::is_trivially_constructible_v<T>;
38template <std::constructible_from<NoInit> T>
52template <
typename V,
typename I>
66 [[nodiscard]]
auto size()
const {
return size_.
val; }
67 [[nodiscard]]
bool empty()
const {
return size_.
val == 0; }
69 void clear() { data_.reset(); capacity_ = {}; size_ = {}; }
73 if ( size_.
val == newSize )
75 if ( newSize > capacity_.
val )
77#if __cpp_lib_smart_ptr_for_overwrite >= 202002L
78 data_ = std::make_unique_for_overwrite<T[]>( capacity_.
val = newSize );
80 data_.reset(
new T[capacity_.
val = newSize] );
88 assert( i < size_.
val );
93 assert( i < size_.
val );
97 [[nodiscard]]
auto data() {
return data_.get(); }
98 [[nodiscard]]
auto data()
const {
return data_.get(); }
101 [[nodiscard]]
I beginId()
const {
return I{ size_t(0) }; }
113 std::unique_ptr<T[]> data_;
118template <
typename T,
typename I>
121 return key ? T{bmap[key]} : T{};
124template <
typename T,
typename I>
128template <
typename T,
typename I>
132template <
typename T,
typename I>
136template <
typename T,
typename I>
141template <
typename T,
typename I>
152 UndirectedEdgeBMap
e;
164 for ( T x( 0 ); x < b.
b.
size(); ++x )
167 if ( bx < a.
b.
size() )
std::vector<V>-like container that is 1) resized without initialization of its elements,...
Definition MRBuffer.h:54
I backId() const
returns the identifier of the back() element
Definition MRBuffer.h:104
void clear()
Definition MRBuffer.h:69
auto size() const
Definition MRBuffer.h:66
auto data()
Definition MRBuffer.h:97
typename NoCtor< V >::type T
Definition MRBuffer.h:56
bool empty() const
Definition MRBuffer.h:67
auto data() const
Definition MRBuffer.h:98
I beginId() const
returns the identifier of the first element
Definition MRBuffer.h:101
size_t heapBytes() const
returns the amount of memory this object occupies on heap
Definition MRBuffer.h:110
const_reference operator[](I i) const
Definition MRBuffer.h:86
T & reference
Definition MRBuffer.h:57
void resize(size_t newSize)
Definition MRBuffer.h:71
I endId() const
returns backId() + 1
Definition MRBuffer.h:107
reference operator[](I i)
Definition MRBuffer.h:91
const T & const_reference
Definition MRBuffer.h:58
const T * const_iterator
Definition MRBuffer.h:60
auto capacity() const
Definition MRBuffer.h:65
T * iterator
Definition MRBuffer.h:59
Buffer(size_t size)
Definition MRBuffer.h:63
auto begin(const BitSet &a)
Definition MRMesh/MRBitSet.h:280
auto end(const BitSet &)
Definition MRMesh/MRBitSet.h:282
Definition MRCameraOrientationPlugin.h:8
T getAt(const Buffer< T, I > &bmap, I key)
given some buffer map and a key, returns the value associated with the key, or default value if key i...
Definition MRBuffer.h:119
I
Definition MRMesh/MRMeshFwd.h:88
BMap< T, T > compose(const BMap< T, T > &a, const BMap< T, T > &b)
computes the composition of two mappings x -> a(b(x))
Definition MRBuffer.h:159
flat map: I -> T
Definition MRBuffer.h:143
Buffer< T, I > b
Definition MRBuffer.h:144
size_t tsize
target size, all values inside b must be less than this value
Definition MRBuffer.h:145
T type
Definition MRBuffer.h:34
Definition MRNoDefInit.h:11
Definition MRBuffer.h:151
UndirectedEdgeBMap e
Definition MRBuffer.h:152
VertBMap v
Definition MRBuffer.h:154
FaceBMap f
Definition MRBuffer.h:153
constexpr ZeroOnMove(ZeroOnMove &&z) noexcept
Definition MRBuffer.h:19
T val
Definition MRBuffer.h:16
constexpr ZeroOnMove(const ZeroOnMove &) noexcept=delete
constexpr ZeroOnMove & operator=(const ZeroOnMove &) noexcept=delete
constexpr ZeroOnMove() noexcept
Definition MRBuffer.h:17