'_IsFirstIteration' : std::lower_bound 中未引用的形式参数

'_IsFirstIteration' : unreferenced formal parameter in std::lower_bound

本文关键字:参数 引用 lower IsFirstIteration std bound      更新时间:2023-10-16

在尝试使用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)

一开始我会说你没有做错什么。

在我看来,他们只是忘记了使用参数,或者他们无法更新签名,忘记了静音该函数的警告。

我不会担心的。