darray: correct the empty condition

This commit is contained in:
Danny Robson 2018-11-09 15:01:35 +11:00
parent 26edf25b82
commit 8c0c374a53
2 changed files with 6 additions and 1 deletions

View File

@ -89,7 +89,7 @@ namespace cruft {
constexpr auto capacity (void) const noexcept { return CapacityV; }
constexpr auto remain (void) const noexcept { return capacity () - size (); }
constexpr bool empty (void) const noexcept { return !!m_size; }
constexpr bool empty (void) const noexcept { return m_size == 0; }
constexpr bool full (void) const noexcept { return m_size == CapacityV; }

View File

@ -6,6 +6,11 @@ main (int, char**)
{
cruft::TAP::logger tap;
{
cruft::darray<8,int> val;
tap.expect (val.empty (), "default initialisation is empty");
}
{
cruft::darray<8,int> val ({ 0, 1, 2, 3, 4, 5, 6, 7});