From 15c49a8437119e895f03a0dfbe648756013bdd0e Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Tue, 10 Nov 2020 15:29:10 +1000 Subject: [PATCH] set/dest: add clear operation --- set/dset.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/set/dset.hpp b/set/dset.hpp index 5d52810c..670c8484 100644 --- a/set/dset.hpp +++ b/set/dset.hpp @@ -18,6 +18,10 @@ namespace cruft::set { /// A multiset container whose storage is a constant capacity fixed at /// 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 < typename ValueT, std::size_t MaxV @@ -45,7 +49,10 @@ namespace cruft::set { decltype(auto) begin (void) const& { return m_data.data (); } 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. ///