多于一个结构匹配参数列表
More than one construction matches argument list
我尝试用VS2010编译它
long long min = std::numeric_limits<int>::min();
unsigned long long max = std::numeric_limits<int>::max();
std::bitset<64> minimal(min);//here I'm getting the error
cout << "minimal: " << minimal;
error:
error C2668: 'std::bitset<_Bits>::bitset' : ambiguous call to overloaded function
1> with
1> [
1> _Bits=64
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludebitset(136): could be 'std::bitset<_Bits>::bitset(_ULonglong)'
1> with
1> [
1> _Bits=64
1> ]
1> c:program filesmicrosoft visual studio 10.0vcincludebitset(127): or 'std::bitset<_Bits>::bitset(int)'
1> with
1> [
1> _Bits=64
1> ]
1> while trying to match the argument list '(__int64)'
为什么?显然,这个参数是long long类型,构造函数应该用于该类型。我不明白这是怎么回事
我不认为long long
是您在该列表中给出的选项之一。我只看到:
- _ULonglong int
- _int64
为什么不将min
转换为unsigned long long
,看看是否可以修复它。或者更好的是,使用 unsigned类型—您是否有可能在中使用具有负数元素的 bitset ?: -)
这是VC2010中的一个错误,它已在VC2011中修复。
这里是Bug报告注意这里的注释
相关文章:
- 概念中的cv限定符需要表达式参数列表
- 在没有参数列表的情况下使用模板名称"Event"无效,模板问题
- 错误 没有与参数列表匹配的重载函数"getline"实例
- std::vector 没有重载函数的实例与参数列表匹配
- 模板参数列表中的 false 在模板初始化期间计算为什么?
- C++模板/别名 - 模板参数列表中参数 1 处的类型/值不匹配
- 构造函数/函数声明参数列表中的统一初始化
- 模板化检查是否存在带有参数列表的类成员函数?
- 如何将类成员方法的参数列表自动填充写入可变参数?
- 带有整数的变量参数列表
- 转发变量参数列表以模拟 std::thread
- 错误:"模板<类_Tp,类_Dp>类 std::unique_ptr"的模板参数列表中参数 1 的类型/值不匹配
- C++-将具有引用的长参数列表重构为结构
- 缺少别名模板C++参数列表
- C++如果两个模板函数都与参数列表匹配,将调用哪个模板
- "extern"声明以及带有和不带参数列表的类模板实例的后续定义
- 使用显式模板参数列表和 [temp.arg.explicit]/3 的函数调用的演绎失败
- 没有函数模板的实例与我不知道为什么的参数列表匹配
- 我可以使用宏自动构建参数列表吗?
- 类成员函数参数列表是否可以依赖于模板参数?