From cf141e45d2b215af0838b18fb1cdc6ad742589f1 Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 22 Jul 2020 13:27:32 +1000 Subject: [PATCH] sarray: add an `empty` query --- array/sarray.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/array/sarray.hpp b/array/sarray.hpp index 24dd972c..4602234d 100644 --- a/array/sarray.hpp +++ b/array/sarray.hpp @@ -99,6 +99,14 @@ namespace cruft { return m_size; } + + //--------------------------------------------------------------------- + bool empty (void) const + { + return m_size == 0; + } + + //--------------------------------------------------------------------- T& operator[] (std::size_t i)& { return m_data.objects[i]; } const T& operator[] (std::size_t i) const& { return m_data.objects[i]; }