diff options
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/kstd/kstd/flat_map | 16 | ||||
| -rw-r--r-- | libs/kstd/kstd/flat_map.test.cpp | 10 |
2 files changed, 26 insertions, 0 deletions
diff --git a/libs/kstd/kstd/flat_map b/libs/kstd/kstd/flat_map index f12b1b5..943e9fc 100644 --- a/libs/kstd/kstd/flat_map +++ b/libs/kstd/kstd/flat_map @@ -356,6 +356,22 @@ namespace kstd return find(key) != cend(); } + //! Get a reference to the keys container. + //! + //! @return a reference to the keys container. + [[nodiscard]] constexpr auto keys() const noexcept -> key_container_type const & + { + return m_containers.keys; + } + + //! Get a reference to the values container. + //! + //! @return a reference to the values container. + [[nodiscard]] constexpr auto values() const noexcept -> mapped_container_type const & + { + return m_containers.values; + } + private: containers m_containers; key_compare m_comparator; diff --git a/libs/kstd/kstd/flat_map.test.cpp b/libs/kstd/kstd/flat_map.test.cpp index 2e5a47c..6c57173 100644 --- a/libs/kstd/kstd/flat_map.test.cpp +++ b/libs/kstd/kstd/flat_map.test.cpp @@ -20,6 +20,16 @@ SCENARIO("Flat Map initialization and construction", "[flat_map]") { REQUIRE_FALSE(map.contains(1)); } + + THEN("the keys container is empty") + { + REQUIRE(map.keys().empty()); + } + + THEN("the values container is empty") + { + REQUIRE(map.values().empty()); + } } } } |
