std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::keys
From cppreference.com
< cpp | container | flat multimap
C++
Containers library
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(C++11)
|
||||
| Associative | ||||
| Unordered associative | ||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
|
(C++11)
|
||||
| Adaptors | ||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
|
(C++23)
|
||||
| Views | ||||
|
(C++20)
|
||||
|
(C++23)
|
||||
| Tables | ||||
| Iterator invalidation | ||||
| Member function table | ||||
| Non-member function table |
|
const key_container_type& keys(
)
const
noexcept
;
|
(since C++23) | |
Return a constant reference to the adapted keys container. Equivalent to return c.keys;.
Parameters
(none)
Return value
The underlying keys container.
Complexity
Constant.
Example
Run this code
#include <flat_map> #include <print> #include <type_traits> #include <vector> int main() { std::flat_multimap<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<int>&>); std::println("{}", adaptor.keys()); }
Output:
[1, 2, 3]
See also
| direct access to the underlying values container (public member function) |