set/dest: add clear operation

This commit is contained in:
Danny Robson 2020-11-10 15:29:10 +10:00
parent 5b38c030fa
commit 15c49a8437

View File

@ -18,6 +18,10 @@
namespace cruft::set { namespace cruft::set {
/// A multiset container whose storage is a constant capacity fixed at /// A multiset container whose storage is a constant capacity fixed at
/// compile time. /// compile time.
///
/// TODO: ValueT really should be a trivial type given the types of
/// assumptions we're making. eg, not calling destructors after
/// lifetimes expire during resize.
template < template <
typename ValueT, typename ValueT,
std::size_t MaxV std::size_t MaxV
@ -45,7 +49,10 @@ namespace cruft::set {
decltype(auto) begin (void) const& { return m_data.data (); } decltype(auto) begin (void) const& { return m_data.data (); }
decltype(auto) end (void) const& { return begin () + m_size; } decltype(auto) end (void) const& { return begin () + m_size; }
void clear (void); void clear (void)
{
m_size = 0;
}
/// A list of items to add to this set. /// A list of items to add to this set.
/// ///