34 template <
typename T, std::
size_t N >
64 std::uninitialized_fill( begin(), begin() + M, item );
67 template < std::
size_t M >
93 template < std::
size_t M >
107 for (
size_type i = 0; i < shared_n; ++i )
108 swap( storage_[i], other.storage_[i] );
110 if ( size() > other.size() ) {
111 for (
size_type i = shared_n; i < size(); ++i )
112 other.emplace_back( std::move( storage_[i] ) );
113 while ( shared_n != size() )
115 }
else if ( size() < other.size() ) {
116 for (
size_type i = shared_n; i < other.size(); ++i )
117 emplace_back( std::move( other.storage_[i] ) );
118 while ( shared_n != other.size() )
123 [[nodiscard]] T*
data()
125 return storage_.data();
128 [[nodiscard]] T
const*
data()
const
130 return storage_.data();
140 return begin() +
size_;
150 return begin() +
size_;
163 void push_back( T item )
165 emplace_back( std::move( item ) );
168 template <
typename... Args >
169 T& emplace_back( Args&&...
args )
171 T& ref = storage_.emplace_item(
size_, std::forward< Args >(
args )... );
176 [[nodiscard]] T take_back()
178 T item = std::move( back() );
185 storage_.delete_item(
size_ - 1 );
191 return storage_[
size_ - 1];
196 return storage_[
size_ - 1];
201 [[nodiscard]] constexpr std::size_t
max_size()
const
206 [[nodiscard]] std::size_t size()
const
211 [[nodiscard]]
bool empty()
const
216 [[nodiscard]]
bool full()
const
242 static_storage< T, N > storage_;
245 template <
typename Container >
248 size_ = std::size( cont );
249 std::uninitialized_copy( std::begin( cont ), std::end( cont ), begin() );
252 template <
typename Container >
255 size_ = std::size( cont );
256 std::uninitialized_move( std::begin( cont ), std::end( cont ), begin() );
262 std::destroy_n( begin(),
size_ );
267 template <
typename T, std::
size_t N >
270 return std::lexicographical_compare_three_way(
271 std::begin( lh ), std::end( lh ), std::begin( rh ), std::end( rh ) );
274 template <
typename T, std::
size_t N >
277 auto size = std::size( lh );
278 if ( size != std::size( rh ) )
281 for ( std::size_t i = 0; i < size; ++i )
282 if ( lh[i] != rh[i] )
287 template <
typename T, std::
size_t N >
290 return !( lh == rh );
293 template <
typename T, std::
size_t N >
299 #ifdef EMLABCPP_USE_OSTREAM
301 template <
typename T, std::
size_t N >
302 std::ostream&
operator<<( std::ostream& os, static_vector< T, N >
const& vec )
304 return os <<
view{ vec };
Data container for up to N elements.
Definition: static_vector.h:36
void purge()
Cleans entire buffer from items.
Definition: static_vector.h:260
T const * const_iterator
Definition: static_vector.h:46
static_vector(static_vector &&other) noexcept
Definition: static_vector.h:55
static_vector & operator=(static_vector const &other)
Definition: static_vector.h:74
void move_from(Container &cont)
Definition: static_vector.h:253
static_vector(std::size_t M, T const &item)
Definition: static_vector.h:61
std::size_t size_type
Definition: static_vector.h:42
void copy_from(Container const &cont)
count of items
Definition: static_vector.h:246
T const & const_reference
Definition: static_vector.h:44
static_vector(static_vector const &other)
Definition: static_vector.h:50
static_vector & operator=(static_vector &&other) noexcept
Definition: static_vector.h:83
requires(M<=N) explicit static_vector(std
Definition: static_vector.h:68
T * iterator
Definition: static_vector.h:45
size_type size_
Definition: static_vector.h:243
static constexpr std::size_t capacity
Definition: static_vector.h:39
T value_type
Definition: static_vector.h:41
requires(M<=N) static_vector &operator
T & reference
Definition: static_vector.h:43
static constexpr std::size_t max_size
Definition: serializer.h:73
MIT License.
Definition: impl.h:31
std::size_t size_type
Definition: static_storage.h:105
constexpr pointer data() noexcept
Returns pointer to first item of the storage.
Definition: static_storage.h:108
constexpr reference operator[](size_type const i) noexcept
Provides a reference to item at position i.
Definition: static_storage.h:136
view(Container &cont) -> view< iterator_of_t< Container > >
The container deduction guide uses iterator_of_t.
Args const & args
Definition: min_max.h:83
void swap(static_vector< T, N > const &lh, static_vector< T, N > const &rh) noexcept
Definition: static_vector.h:294
constexpr Derived max(vec_point_base< Derived, N > const &a, vec_point_base< Derived, N > const &b)
Definition: vec_point_base.h:229
constexpr Derived const & min(vec_point_base< Derived, N > const &a, vec_point_base< Derived, N > const &b)
Definition: vec_point_base.h:236
auto operator<=>(static_circular_buffer< T, N > const &lh, static_circular_buffer< T, N > const &rh)
Definition: static_circular_buffer.h:290
constexpr bool operator!=(pose const &x, pose const &y)
negation of operator== between poses
Definition: pose.h:99
std::ostream & operator<<(std::ostream &os, string_buffer< N > const &sb)
Definition: string_buffer.h:112
N
Definition: static_storage.h:97
constexpr bool operator==(pose const &x, pose const &y)
compares poses on their position and orientation
Definition: pose.h:93