mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Functions4U: More utility functions
git-svn-id: svn://ultimatepp.org/upp/trunk@13028 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
b2fdd9dee0
commit
9faeade3e5
2 changed files with 14 additions and 3 deletions
|
|
@ -667,14 +667,23 @@ void Shuffle(C &data, int randomSeed = Null) {
|
|||
}
|
||||
|
||||
template <class Range, class V>
|
||||
void FindAdd(Range& r, const V& value, int from = 0)
|
||||
{
|
||||
void FindAdd(Range& r, const V& value, int from = 0) {
|
||||
for(int i = from; i < r.GetCount(); i++)
|
||||
if(r[i] == value)
|
||||
return;
|
||||
r.Add(value);
|
||||
}
|
||||
|
||||
template <class Range>
|
||||
bool Compare(Range& a, Range& b, int from = 0) {
|
||||
if (a.GetCount() != b.GetCount())
|
||||
return false;
|
||||
for(int i = from; i < a.GetCount(); i++)
|
||||
if(a[i] != b[i])
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
class RealTimeStop {
|
||||
typedef RealTimeStop CLASSNAME;
|
||||
public:
|
||||
|
|
@ -874,4 +883,6 @@ int LevenshteinDistance(const char *s, const char *t);
|
|||
int DamerauLevenshteinDistance(const char *s, const char *t, int alphabetLength = 256);
|
||||
int SentenceSimilitude(const char *s, const char *t);
|
||||
|
||||
#define x_(y) String(y)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -148,4 +148,4 @@ int GetEditWidth(const String str) {
|
|||
}
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue