'_IsFirstIteration' : std::lower_bound 中未引用的形式参数
'_IsFirstIteration' : unreferenced formal parameter in std::lower_bound
在尝试使用std::lower_bound函数时,我收到了著名的C4100警告。
这是我的代码:
typedef std::vector<SDTSPosition> TPTSFileOffsetVector;
TPTSFileOffsetVector::iterator lowest_nearest = std::lower_bound(m_position_table.begin(),
m_position_table.end(), SDTSPosition(dts_position, 0), SDTSPosition());
比较器在结构内部:
// positioning
struct SDTSPosition
{
SDTSPosition() {}
SDTSPosition(int d, int p)
{
dts = d;
pos = p;
}
int dts;
int pos;
bool operator()(const SDTSPosition & left, const SDTSPosition & right) const
{
return left.dts < right.dts;
}
};
编译警告指向stl:中的这段代码
template<class _FwdIt,
class _Pr> inline
void __CLRCALL_OR_CDECL _Debug_order_single2(_FwdIt _First, _FwdIt _Last, _Pr _Pred, bool _IsFirstIteration,
const wchar_t *_File, unsigned int _Line, forward_iterator_tag)
{ // test if _First and ++_First ordered by predicate, forward iterators
if (_First != _Last)
{
_FwdIt _Next = _First;
if (++_Next != _Last)
if (_DEBUG_LT_PRED(_Pred, *_Next, *_First))
_DEBUG_ERROR2("sequence not ordered", _File, _Line);
}
}
其中确实没有对所述布尔变量的引用。
我做错什么了吗?(顺便说一句,这是VS2005)
一开始我会说你没有做错什么。
在我看来,他们只是忘记了使用参数,或者他们无法更新签名,忘记了静音该函数的警告。
我不会担心的。
相关文章:
- 将const引用参数初始化为默认参数会导致悬空引用吗
- 通过常量引用传递参数的矩阵模板类
- 非类型指针和引用模板参数,以及在编译时如何/为什么解析它们.c++
- 何时应通过引用传递矢量参数而不是按值传递矢量参数?
- 具有常量引用参数的函数模板专用化
- 作为参数引用
- 在 cpp 文件中隐藏采用模板参数引用的方法
- 如何传递带有通过引用传递的结构参数的函数?
- 将输入参数作为右值引用传递?
- 使用引用与指针将数组作为参数传递
- 根据模板参数引用不同基类的函数
- 默认情况下C++数组作为参数引用
- 对指针C++的参数引用
- 作为非类型模板参数引用
- 重用返回语句或按参数引用返回
- 将参数引用传递给函数C++
- 从另一个参数引用的模板可变参数
- 成员变量多态性和参数引用
- 按参数引用或按参数引用之间的差异
- 无法实例化抽象类:为什么模板参数(引用)导致这种情况