Namespaces
Variants

std::flat_multimap<Key,T,Compare,KeyContainer,MappedContainer>:: values

From cppreference.net

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]

参见

直接访问底层键容器
(公开成员函数)