diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/include/kstd/flat_map | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/libs/kstd/include/kstd/flat_map b/libs/kstd/include/kstd/flat_map index 6ffbbcf..3b13754 100644 --- a/libs/kstd/include/kstd/flat_map +++ b/libs/kstd/include/kstd/flat_map @@ -205,6 +205,24 @@ namespace kstd return const_reverse_iterator{cbegin()}; } + //! Check whether this flat map is empty or not + [[nodiscard]] auto empty() const noexcept -> bool + { + return m_containers.keys.empty(); + } + + //! Get the number of elements in this flat map. + [[nodiscard]] auto size() const noexcept -> size_type + { + return m_containers.keys.size(); + } + + //! Get the maximum number of elements possible in this flat map + [[nodiscard]] auto max_size() const noexcept -> size_type + { + return std::min(m_containers.keys.max_size(), m_containers.values.max_size()); + } + //! Try to insert a new key-value pair into the map. //! //! @param args Arguments to use for constructing the key-value pair. |
