std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::keys
来自 cppreference.cn
< cpp | 容器 | flat multimap
const key_container_type& keys() const noexcept; |
(since C++23) | |
返回到适配的键容器的常量引用。等价于 return c.keys;.
目录 |
[edit] 参数
(none)
[edit] 返回值
底层键容器。
[edit] 复杂度
常数。
[edit] 示例
运行此代码
#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()); }
输出
[1, 2, 3]
[edit] 参见
直接访问底层值容器 (public member function) |