std::flat_map<Key,T,Compare,KeyContainer,MappedContainer>::keys - cppreference.com (original) (raw)

| const key_container_type& keys() const noexcept; | | (since C++23) | | -------------------------------------------------- | | ------------- |

Return a constant reference to the adapted keys container. Equivalent toreturn c.keys;.

[edit] Parameters

(none)

[edit] Return value

The underlying keys container.

[edit] Complexity

Constant.

[edit] Example

#include #include #include #include   int main() { std::flat_map<int, double> adaptor{{1, 1.1}, {2, 2.2}, {3, 3.3}};   // The default keys container is std::vector: static_assert(std::is_same_v<decltype(adaptor.keys()), const std::vector&>);   std::println("{}", adaptor.keys()); }

Output:

[edit] See also

| | direct access to the underlying values container (public member function) [edit] | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |