gpt4 book ai didi

c++ - 编译使用 C++ 映射的代码时遇到问题

转载 作者:行者123 更新时间:2023-11-28 07:31:46 24 4
gpt4 key购买 nike

<分区>

我有以下代码:

std::map<
const CosTransactions::otid_t,
std::pair<
CosTransactions::otid_t,
CosTransactions::Coordinator_ptr>,
otid_t_less> XID_Broker_impl::cache;

编译上述代码时出现如下错误:

D:/Y24\usr\include/xmemory", line 144: error(483): function
"std::allocator<_Ty>::address(std::_Allocator_base<_Ty>::value_type
&) const [with _Ty=const CosTransactions::otid_t]" has already been
declared
detected during:
instantiation of class

我正在使用 HP-Nonstop C++ 编译器?当我删除 map 中键的“常量”时,错误消失了。这是否意味着我不能在 map 中使用“const key”?请帮我解决这个问题

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