1

I'm getting the famous C4100 warning when trying to use std::lower_bound function.

this is my code:

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());

the comparator is inside the struct:

// 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;        
    }   
};

The compilation warning points me to this code in the 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);
    }
}

where there indeed no reference to said boolean variable.

Am I doing anything wrong? (this is VS2005 by the way)

Yakk - Adam Nevraumont
  • 262,606
  • 27
  • 330
  • 524
NiRR
  • 4,782
  • 5
  • 32
  • 60

1 Answers1

1

At first i'd say you are not doing anything wrong.

It seems to me they just forgot to use the parameter or they could not update the signature and forgot to silence the warning for this function.

I would not worry.

RedX
  • 14,749
  • 1
  • 53
  • 76