std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>::values
来自cppreference.com
<tbody>
</tbody>
const mapped_container_type& values() const noexcept; |
(C++23 起) | |
返回对所适配的值容器的常量引用。等价于 return c.values;。
参数
(无)
返回值
底层值容器。
复杂度
常数。
示例
运行此代码
#include <flat_map>
#include <print>
#include <type_traits>
#include <vector>
int main()
{
std::flat_multimap<int, double> map{{1, 1.1}, {2, 2.2}, {3, 3.3}};
// 默认的值容器是 std::vector:
static_assert(std::is_same_v<decltype(map.values()), const std::vector<int>&>);
std::println("{}", map.values());
}
输出:
[1.1, 2.2, 3.3]
参阅
| 直接访问底层键容器 (公开成员函数) |