gpt4 book ai didi

c++ - 跳过 C++ 模板参数

转载 作者:可可西里 更新时间:2023-11-01 18:09:56 25 4
gpt4 key购买 nike

C++ hash_map 具有以下模板参数:

template<typename Key, typename T, typename HashCompare, typename Allocator>

如何在不指定 HashCompare 的情况下指定分配器?

这不会编译:(

hash_map<EntityId, Entity*, , tbb::scalable_allocator>

最佳答案

简单的回答是你不能。您不能跳过模板参数并让它选择模板的默认值。您唯一的选择是找出默认值并将其插入您的声明中。

关于c++ - 跳过 C++ 模板参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1276020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com