std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>:: keys
From zh.cppreference.net
<
cpp
|
container
|
flat multimap
C++
Containers library
|
(C++17)
|
||||
| Sequence | ||||
|
(C++11)
|
||||
|
(C++26)
|
||||
|
(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 |
std::flat_multimap
|
const
key_container_type
&
keys
(
)
const
noexcept
;
|
(C++23 起) | |
返回被适配键容器的常量引用。等价于 return c. keys ; 。
内容返回值底层键容器。 复杂度常量。 示例
运行此代码
#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}}; // 默认的键容器是 std::vector: static_assert(std::is_same_v<decltype(adaptor.keys()), const std::vector<int>&>); std::println("{}", adaptor.keys()); } 输出: [1, 2, 3] 参见
|