gpt4 book ai didi

c++ - VC++11 映射和多映射迭代器(重载)C2535

转载 作者:塔克拉玛干 更新时间:2023-11-03 01:38:10 25 4
gpt4 key购买 nike

我正在玩新的 VS 2012,我可能对新的 C++11 有疑问。当我在项目设置中将平台工具集设置为 VS2010 (v100) 时,这段代码完美运行。

.h:

typedef std::multimap<unsigned, unsigned>   SizeMap;
typedef std::map<unsigned, unsigned> OffsetMap;

private:
inline void _RemoveBlockL(SizeMap::iterator sizeI);
inline void _RemoveBlockL(OffsetMap::iterator offsetI);

.cpp:

inline void Foo::_RemoveBlockL(SizeMap::iterator sizeI)
{
// impementation
}

inline void Foo::_RemoveBlockL(OffsetMap::iterator offsetI)
{
// impementation
}

但是当我为 VS2012 (v110) 更改它时,我会得到这些错误:

Error   61  error C2535: 'void
Boo::system::Foo::_RemoveBlockL(std::_Tree_iterator<_Mytree>)' : member function already
defined or declared D:\_work\wp-test\boo\system\foo.h

为什么重载在 VC++11 中不起作用?

最佳答案

这只是一种可能性,我目前无法检查,但他们改变了迭代器在 vc++11 中的实现方式,因此它们可能是相同的底层类型,因此无法对其进行重载。

是否要求不同容器类型的迭代器本身具有不同的类型?

查看此 http://blogs.msdn.com/b/vcblog/archive/2012/04/06/10291485.aspx

关于c++ - VC++11 映射和多映射迭代器(重载)C2535,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12302079/

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