From 373374785606bc6d765b096d7423d3f17db7626a Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Mon, 2 Oct 2017 23:28:27 +0200 Subject: [PATCH] [DEV] add empty function --- etk/String.hpp | 8 ++++++++ etk/UString.hpp | 8 ++++++++ etk/Vector.hpp | 7 ++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/etk/String.hpp b/etk/String.hpp index 149ff50..d148ce5 100644 --- a/etk/String.hpp +++ b/etk/String.hpp @@ -301,6 +301,14 @@ namespace etk { * @return The number requested */ size_t size() const; + /** + * @brief Check if the container have some element + * @return true The container is empty + * @return famse The container have some element + */ + bool empty() const { + return size() == 0; + } /** * @brief Get a current element in the string * @param[in] _pos Desired position read diff --git a/etk/UString.hpp b/etk/UString.hpp index 51b6a9a..cf4eaf0 100644 --- a/etk/UString.hpp +++ b/etk/UString.hpp @@ -300,6 +300,14 @@ namespace etk { * @return The number requested */ size_t size() const; + /** + * @brief Check if the container have some element + * @return true The container is empty + * @return famse The container have some element + */ + bool empty() const { + return size() == 0; + } /** * @brief Get a current element in the string * @param[in] _pos Desired position read diff --git a/etk/Vector.hpp b/etk/Vector.hpp index 94012d8..63b1174 100644 --- a/etk/Vector.hpp +++ b/etk/Vector.hpp @@ -343,7 +343,12 @@ namespace etk { size_t size() const { return m_size; } - size_t empty() const { + /** + * @brief Check if the container have some element + * @return true The container is empty + * @return famse The container have some element + */ + bool empty() const { return m_size == 0; } /**