port to std::algorithm

Change-Id: I537b9ffc3eed0891bed0fcae3e0d79d70cc46cec
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Oswald Buddenhagen 2014-01-15 21:24:28 +01:00 committed by The Qt Project
parent f98a96fded
commit 327424d608
3 changed files with 7 additions and 6 deletions

View File

@ -174,7 +174,7 @@ void Compress::operator () (int *table, int row_count, int column_count)
sortedTable [i].assign (i, begin, end); sortedTable [i].assign (i, begin, end);
} }
qSort (sortedTable.begin (), sortedTable.end (), _SortUncompressedRow ()); std::sort (sortedTable.begin (), sortedTable.end (), _SortUncompressedRow ());
#ifndef QLALR_NO_CHECK_SORTED_TABLE #ifndef QLALR_NO_CHECK_SORTED_TABLE
int previous_zeros = INT_MAX; int previous_zeros = INT_MAX;

View File

@ -166,7 +166,7 @@ State::State (Grammar *g):
QPair<ItemPointer, bool> State::insert (const Item &item) QPair<ItemPointer, bool> State::insert (const Item &item)
{ {
ItemPointer it = qFind (kernel.begin (), kernel.end (), item); ItemPointer it = std::find (kernel.begin (), kernel.end (), item);
if (it != kernel.end ()) if (it != kernel.end ())
return qMakePair (it, false); return qMakePair (it, false);
@ -176,7 +176,7 @@ QPair<ItemPointer, bool> State::insert (const Item &item)
QPair<ItemPointer, bool> State::insertClosure (const Item &item) QPair<ItemPointer, bool> State::insertClosure (const Item &item)
{ {
ItemPointer it = qFind (closure.begin (), closure.end (), item); ItemPointer it = std::find (closure.begin (), closure.end (), item);
if (it != closure.end ()) if (it != closure.end ())
return qMakePair (it, false); return qMakePair (it, false);
@ -207,7 +207,7 @@ Grammar::Grammar ():
Name Grammar::intern (const QString &id) Name Grammar::intern (const QString &id)
{ {
Name name = qFind (names.begin (), names.end (), id); Name name = std::find (names.begin (), names.end (), id);
if (name == names.end ()) if (name == names.end ())
name = names.insert (names.end (), id); name = names.insert (names.end (), id);
@ -322,7 +322,7 @@ void Automaton::buildNullables ()
QPair<StatePointer, bool> Automaton::internState (const State &state) QPair<StatePointer, bool> Automaton::internState (const State &state)
{ {
StatePointer it = qFind (states.begin (), states.end (), state); StatePointer it = std::find (states.begin (), states.end (), state);
if (it != states.end ()) if (it != states.end ())
return qMakePair (it, false); return qMakePair (it, false);

View File

@ -50,6 +50,7 @@
#include <QtCore/qtextstream.h> #include <QtCore/qtextstream.h>
#include <QtCore/qpair.h> #include <QtCore/qpair.h>
#include <algorithm>
#include <functional> #include <functional>
class Rule; class Rule;
@ -319,7 +320,7 @@ typename Node<_Tp>::iterator Node<_Tp>::get (_Tp data)
template <typename _Tp> template <typename _Tp>
QPair<typename QLinkedList<typename Node<_Tp>::iterator>::iterator, bool> Node<_Tp>::insertEdge (typename Node<_Tp>::iterator other) const QPair<typename QLinkedList<typename Node<_Tp>::iterator>::iterator, bool> Node<_Tp>::insertEdge (typename Node<_Tp>::iterator other) const
{ {
edge_iterator it = qFind (outs.begin (), outs.end (), other); edge_iterator it = std::find (outs.begin (), outs.end (), other);
if (it != outs.end ()) if (it != outs.end ())
return qMakePair (it, false); return qMakePair (it, false);