c++ - '_IsFirstIteration':std::lower_bound 中未引用的形参

标签 c++ visual-studio-2005 stl-algorithm

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

确实没有对所述 bool 变量的引用。

我做错了什么吗? (顺便说一下,这是 VS2005)

最佳答案

起初我会说你没有做错任何事。

在我看来,他们只是忘记了使用该参数,或者他们无法更新签名而忘记关闭此功能的警告。

我不会担心。

关于c++ - '_IsFirstIteration':std::lower_bound 中未引用的形参,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17722152/

相关文章:

c++ - 从元组中 Cerr'ing 变量时崩溃

c++ - 计算(64 位无符号整数)*(64 位无符号整数)除以 2^64 的商

c++ - 我什么时候可以自信地使用 -O3 编译程序?

visual-studio-2005 - 在Visual Studio 2005中,当前表单上是否存在控件列表?

visual-studio-2008 - 如何在 VS 2005 中打开 VS 2008 解决方案?

c++ - 是否允许标准库算法复制谓词参数?

c++ - MySQL 连接器 8.0 C++ 错误 : "CDK: Failed string conversion"

c# - 请求有关 Visual Studio 2008 的 Windows CE 平台的信息

c++ - std::upper_bound 在空结束范围内的定义行为是什么?

c++ - 为什么有些 STL 算法提供额外的 '_if' 函数而不是重载?