mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-05 17:44:55 -06:00
Core: Algo cleanup, refactoring
git-svn-id: svn://ultimatepp.org/upp/trunk@6425 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0772febd96
commit
7969474fcf
12 changed files with 442 additions and 363 deletions
|
|
@ -1,3 +1,20 @@
|
|||
template<class T>
|
||||
struct StdEqual
|
||||
{
|
||||
bool operator () (const T& a, const T& b) const { return a == b; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct StdLess {
|
||||
bool operator () (const T& a, const T& b) const { return a < b; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct StdGreater
|
||||
{
|
||||
bool operator () (const T& a, const T& b) const { return a > b; }
|
||||
};
|
||||
|
||||
template <class T>
|
||||
inline int sgn(T a) { return a > 0 ? 1 : a < 0 ? -1 : 0; }
|
||||
|
||||
|
|
@ -31,40 +48,28 @@ void Sum(V& sum, T ptr, T end)
|
|||
}
|
||||
|
||||
template <class T>
|
||||
typename T::ValueType Sum(const T& c, const typename T::ValueType& init = typename T::ValueType())
|
||||
typename T::ValueType Sum(const T& c, const typename T::ValueType& zero)
|
||||
{
|
||||
typename T::ValueType sum = init;
|
||||
typename T::ValueType sum = zero;
|
||||
Sum(sum, c.Begin(), c.End());
|
||||
return sum;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
typename T::ValueType Sum0(const T& c)
|
||||
typename T::ValueType Sum(const T& c)
|
||||
{
|
||||
typename T::ValueType sum = 0;
|
||||
Sum(sum, c.Begin(), c.End());
|
||||
return sum;
|
||||
return Sum(c, 0);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T MinElement(T ptr, T end)
|
||||
template <class C, class Pred>
|
||||
int FindBest(const C& c, int pos, int count, const Pred& pred)
|
||||
{
|
||||
ASSERT(ptr != end);
|
||||
T min = ptr;
|
||||
while(++ptr != end)
|
||||
if(*ptr < *min) min = ptr;
|
||||
return min;
|
||||
}
|
||||
|
||||
template <class C>
|
||||
int MinIndex(const C& c)
|
||||
{
|
||||
if(c.GetCount() == 0)
|
||||
if(count == 0)
|
||||
return -1;
|
||||
typename C::ValueType m = c[0];
|
||||
int mi = 0;
|
||||
typename C::ValueType m = c[pos];
|
||||
int mi = pos;
|
||||
for(int i = 1; i < c.GetCount(); i++)
|
||||
if(c[i] < m) {
|
||||
if(pred(c[i], m)) {
|
||||
m = c[i];
|
||||
mi = i;
|
||||
}
|
||||
|
|
@ -72,81 +77,54 @@ int MinIndex(const C& c)
|
|||
}
|
||||
|
||||
template <class C>
|
||||
int MaxIndex(const C& c)
|
||||
int FindMin(const C& c, int pos, int count)
|
||||
{
|
||||
if(c.GetCount() == 0)
|
||||
return -1;
|
||||
typename C::ValueType m = c[0];
|
||||
int mi = 0;
|
||||
for(int i = 1; i < c.GetCount(); i++)
|
||||
if(c[i] > m) {
|
||||
m = c[i];
|
||||
mi = i;
|
||||
}
|
||||
return mi;
|
||||
return FindBest(c, pos, count, StdLess<C::ValueType>());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const typename T::ValueType& Min(const T& c)
|
||||
template <class C>
|
||||
int FindMin(const C& c)
|
||||
{
|
||||
return *MinElement(c.Begin(), c.End());
|
||||
return FindMin(c, 0, c.GetCount());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T MaxElement(T ptr, T end)
|
||||
template <class C>
|
||||
int Min(const C& c)
|
||||
{
|
||||
ASSERT(ptr != end);
|
||||
T max = ptr;
|
||||
while(++ptr != end)
|
||||
if(*max < *ptr) max = ptr;
|
||||
return max;
|
||||
return c[FindMin(c)];
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const typename T::ValueType& Max(const T& c)
|
||||
template <class C>
|
||||
int Min(const C& c, const typename C::ValueType& def)
|
||||
{
|
||||
return *MaxElement(c.Begin(), c.End());
|
||||
int q = FindMax(c);
|
||||
return q < 0 ? def : c[q];
|
||||
}
|
||||
|
||||
template<class T>
|
||||
struct StdEqual
|
||||
template <class C>
|
||||
int FindMax(const C& c, int pos, int count)
|
||||
{
|
||||
bool operator () (const T& a, const T& b) const { return a == b; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct StdLess {
|
||||
bool operator () (const T& a, const T& b) const { return a < b; }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct StdGreater
|
||||
{
|
||||
bool operator () (const T& a, const T& b) const { return a > b; }
|
||||
};
|
||||
|
||||
/*
|
||||
template <class T, class C>
|
||||
bool Compare(T ptr1, T end1, T ptr2, T end2, const C& compare)
|
||||
{
|
||||
for(; ptr1 != end1 && ptr2 != end2; ++ptr1, ++ptr2)
|
||||
if(!compare(*ptr1, *ptr2)) return false;
|
||||
return ptr1 == end1 && ptr2 == end2;
|
||||
return FindBest(c, pos, count, StdGreater<C::ValueType>());
|
||||
}
|
||||
|
||||
template <class T, class C>
|
||||
bool Compare(const T& c1, const T& c2, const C& compare)
|
||||
template <class C>
|
||||
int FindMax(const C& c)
|
||||
{
|
||||
return Compare(c1.Begin(), c1.End(), c2.Begin(), c2.End(), compare);
|
||||
return FindMax(c, 0, c.GetCount());
|
||||
}
|
||||
|
||||
template <class T>
|
||||
bool Compare(const T& c1, const T& c2)
|
||||
template <class C>
|
||||
int Max(const C& c)
|
||||
{
|
||||
typedef typename T::ValueType VT;
|
||||
return Compare(c1, c2, StdEqual<VT>());
|
||||
return c[FindMax(c)];
|
||||
}
|
||||
|
||||
template <class C>
|
||||
int Max(const C& c, const typename C::ValueType& def)
|
||||
{
|
||||
int q = FindMax(c);
|
||||
return q < 0 ? def : c[q];
|
||||
}
|
||||
*/
|
||||
|
||||
template <class T, class C>
|
||||
bool IsEqual(T ptr1, T end1, T ptr2, T end2, const C& equal)
|
||||
|
|
@ -1622,3 +1600,16 @@ void StableSortByValue(Map& map)
|
|||
{
|
||||
StableSortByValue(map, StdLess<typename Map::ValueType>());
|
||||
}
|
||||
|
||||
/*
|
||||
// OLD DEPRECATED NAMES:
|
||||
template <class C> // Deprecated
|
||||
int MinIndex(const C& c) { return FindMin(c); }
|
||||
|
||||
template <class C> // Deprecated
|
||||
int MaxIndex(const C& c) { return FindMax(c); }
|
||||
|
||||
template <class C> // Deprecated
|
||||
typename C::ValueType Sum0(const C& c) { return Sum(c); }
|
||||
|
||||
*/
|
||||
12
uppsrc/Core/src.tpp/MathUtil$en-us.tppi
Normal file
12
uppsrc/Core/src.tpp/MathUtil$en-us.tppi
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
TITLE("Math utility")
|
||||
COMPRESSED
|
||||
120,156,205,89,11,115,211,72,18,254,43,83,197,194,58,57,227,204,140,222,118,109,21,20,28,28,117,27,54,11,185,186,170,115,41,177,108,143,157,89,100,201,209,72,121,192,193,111,223,111,36,89,150,29,75,113,178,119,5,144,88,146,213,253,245,215,143,233,30,41,67,78,126,250,137,118,233,19,122,207,191,254,107,49,11,178,48,245,135,210,52,221,65,192,173,193,167,127,254,230,13,180,62,131,190,225,48,195,181,12,102,114,27,31,204,96,220,226,134,201,92,238,153,174,97,184,180,63,9,3,165,252,97,200,93,55,87,226,80,226,142,197,153,99,186,166,203,12,199,229,208,229,148,114,234,112,139,153,134,203,173,254,84,168,137,63,164,16,55,32,238,217,134,71,25,165,14,99,212,224,14,53,44,147,49,131,3,130,59,156,81,171,47,162,169,63,252,135,61,208,10,166,118,202,178,65,221,6,154,105,82,160,107,53,211,96,6,229,134,197,60,203,238,143,197,92,70,187,92,178,238,117,201,161,125,153,138,69,233,81,96,14,14,95,88,3,6,85,187,107,63,113,96,214,180,96,
|
||||
204,211,30,25,80,227,220,182,60,102,153,160,100,82,222,79,196,101,38,19,177,16,81,90,34,72,198,56,27,140,153,51,0,133,111,223,190,245,152,73,139,72,57,224,194,40,120,115,134,239,224,135,195,44,143,122,150,203,92,106,56,38,183,28,184,190,12,146,96,81,122,50,54,249,160,244,195,237,186,79,108,102,35,162,212,5,127,203,3,0,133,19,56,34,144,22,126,12,183,159,150,202,90,79,43,121,93,239,9,130,100,88,212,241,168,99,58,150,9,79,56,179,25,2,73,181,255,72,67,63,138,147,69,16,250,195,47,231,95,201,144,124,249,194,116,149,188,232,32,33,61,147,247,232,1,25,42,58,120,250,148,12,15,95,56,3,147,28,7,233,5,201,82,25,202,244,214,247,191,126,125,230,15,149,49,32,250,144,139,189,36,81,182,24,139,132,196,51,178,128,172,192,135,156,4,33,153,101,209,36,149,113,164,72,16,77,201,4,39,105,16,165,170,183,1,160,15,43,14,111,58,140,187,7,111,243,207,23,108,77,131,188,42,117,201,175,82,165,91,28,172,65,255,120,116,254,
|
||||
247,190,150,211,39,190,254,146,231,138,71,68,60,255,175,254,239,243,158,3,239,93,253,107,34,3,38,202,193,50,236,2,5,146,250,196,172,195,253,250,219,91,94,65,230,23,27,176,97,60,247,135,71,93,194,253,154,13,214,51,81,111,158,69,145,125,215,69,197,155,212,185,199,6,163,117,35,184,218,182,194,168,240,11,120,218,51,81,138,30,138,132,121,40,75,11,174,56,88,30,45,240,239,121,133,253,158,111,2,71,188,66,181,61,172,16,4,135,162,194,60,20,62,245,76,230,180,161,50,186,134,101,116,11,23,95,20,192,188,135,165,106,185,22,245,56,96,17,112,219,197,226,105,198,61,121,183,66,61,121,183,129,121,34,75,68,3,203,10,171,7,139,209,176,92,207,241,176,52,93,179,37,188,39,239,70,231,124,13,138,139,45,92,114,68,86,97,96,61,172,68,7,41,227,182,131,22,225,217,54,243,184,209,142,109,214,177,205,187,216,102,21,98,7,173,200,115,153,109,24,158,131,252,33,196,88,215,205,224,172,30,13,118,39,32,140,212,130,66,123,6,211,128,174,107,227,
|
||||
136,53,111,163,195,24,110,51,56,175,131,243,59,224,124,19,220,54,116,36,28,135,27,182,131,166,101,152,6,117,218,153,127,252,253,195,233,6,251,226,139,59,30,168,203,36,237,156,200,3,191,48,132,214,202,92,244,69,204,5,199,177,108,238,218,72,67,171,23,155,134,248,78,67,124,219,16,235,161,181,32,76,104,171,232,194,22,218,170,131,134,216,108,71,99,86,53,148,95,172,241,177,220,49,95,152,1,182,134,131,20,96,221,187,238,61,88,181,138,44,47,215,120,168,19,140,71,36,208,101,204,181,17,7,139,99,244,181,44,112,94,115,127,219,113,228,112,187,77,239,211,103,223,148,29,187,161,207,126,64,31,143,23,163,206,232,0,134,207,207,166,215,113,50,61,35,249,193,63,135,122,113,223,239,28,84,92,62,136,52,75,48,0,48,21,72,36,110,82,146,228,34,100,46,34,145,4,169,152,150,179,163,71,142,79,137,10,102,34,31,21,98,54,147,19,137,1,75,174,130,68,234,190,143,209,114,44,18,165,160,70,210,107,144,195,184,57,62,101,158,103,56,100,124,75,78,
|
||||
131,79,217,31,146,188,151,234,66,46,178,36,200,81,142,131,79,113,26,235,241,165,178,133,62,147,138,100,10,38,113,58,23,21,149,130,128,234,146,107,137,57,167,137,42,1,161,120,156,6,50,194,201,44,129,208,69,172,82,178,12,131,116,134,217,73,212,82,76,36,40,146,68,168,56,75,38,66,145,206,232,231,163,169,184,58,202,10,212,209,207,68,70,228,36,86,242,134,168,91,208,93,192,192,219,127,189,123,189,242,60,78,180,192,191,101,100,240,131,94,67,142,63,130,199,42,228,121,144,71,135,163,174,140,210,60,252,47,58,180,71,123,216,23,28,144,171,88,22,241,95,43,248,157,59,249,25,29,98,158,27,185,115,126,183,174,14,68,173,141,123,161,136,252,117,238,52,154,90,69,41,15,206,56,155,205,144,171,189,233,62,138,231,154,229,249,232,151,243,33,46,104,43,41,37,163,121,40,80,41,97,38,200,240,233,243,74,189,71,78,47,144,114,252,204,227,184,202,122,16,94,7,183,69,65,170,96,161,147,125,153,137,104,34,116,137,149,165,64,58,200,114,93,66,76,27,
|
||||
115,244,31,145,196,47,147,36,184,29,117,110,114,127,15,73,245,21,156,211,100,110,106,244,223,200,48,84,228,21,9,244,253,21,219,27,191,240,228,51,20,85,147,161,187,145,109,89,128,187,131,90,37,119,239,101,73,20,54,138,161,208,193,8,34,82,130,180,51,180,205,170,63,92,22,20,46,183,232,217,102,83,135,176,205,177,220,90,151,245,205,226,46,83,151,181,112,180,216,219,113,119,35,32,195,251,153,248,143,8,198,172,140,69,109,17,76,227,108,28,138,26,189,89,83,52,102,97,140,141,116,52,39,203,24,75,116,149,17,218,235,177,221,65,193,164,67,121,228,240,45,70,33,229,159,119,118,223,132,71,129,191,155,140,186,204,130,36,95,36,101,209,6,141,174,7,201,28,107,242,98,15,46,165,100,27,31,213,192,231,226,118,41,146,113,28,162,9,7,201,4,40,53,106,170,141,218,36,86,123,82,211,146,109,212,38,143,160,54,105,163,134,39,156,61,169,105,201,54,106,233,94,212,128,82,163,150,54,82,147,10,79,115,98,212,209,163,167,91,125,108,17,44,167,8,41,
|
||||
132,253,206,238,9,115,227,119,119,105,225,206,109,227,157,207,59,156,89,119,206,209,225,234,226,214,199,118,175,60,255,124,143,51,88,91,113,242,32,143,114,141,239,239,150,62,33,93,125,32,36,137,179,104,154,239,103,174,131,4,83,49,18,115,52,140,43,1,35,51,25,233,167,245,246,32,76,132,12,31,20,3,173,240,99,135,96,137,29,215,158,33,152,202,171,237,42,104,114,126,37,250,24,223,219,60,60,90,59,216,37,105,130,205,119,62,123,87,206,104,15,31,144,83,176,220,202,104,139,63,143,77,229,95,116,231,1,249,73,229,66,168,125,51,180,22,254,11,78,145,227,248,10,91,249,82,92,111,24,35,129,161,135,157,127,24,95,99,244,46,178,48,149,203,176,152,130,133,102,59,251,61,211,81,201,254,95,184,95,200,249,197,195,200,207,242,85,213,52,137,86,180,11,41,191,121,8,85,251,94,253,250,238,74,36,169,42,239,151,44,137,95,99,9,84,49,215,207,129,175,46,196,228,147,90,93,147,80,46,100,218,184,41,158,149,245,113,15,211,29,133,241,112,166,43,70,
|
||||
185,219,122,91,214,216,118,31,234,68,81,38,247,248,112,183,62,254,135,46,140,254,246,88,238,57,148,222,136,215,232,159,159,65,217,54,207,72,126,168,21,75,190,19,255,238,229,178,7,219,82,238,199,46,153,61,252,40,196,126,188,178,89,196,211,44,140,43,250,221,123,247,188,133,66,171,35,221,6,221,134,177,85,127,194,26,61,47,30,177,18,177,8,36,246,19,73,109,91,124,227,31,85,83,173,87,161,84,39,167,128,217,80,11,8,166,171,84,250,37,90,188,212,15,211,250,76,22,246,80,186,232,194,90,74,101,227,52,9,38,249,227,157,190,147,135,45,9,66,114,153,197,105,254,230,171,236,215,18,3,116,124,155,203,76,69,20,47,100,148,191,59,202,95,74,229,79,239,217,162,120,157,212,191,203,109,205,107,244,203,90,144,140,158,175,173,96,143,85,131,109,156,102,249,95,34,238,107,81,133,84,219,99,201,180,150,135,85,124,167,205,51,116,25,95,107,171,59,70,103,173,50,10,169,45,171,235,1,41,119,152,148,141,38,139,191,140,201,207,98,93,154,218,250,179,22,
|
||||
251,149,74,187,227,119,6,248,232,89,121,79,220,44,227,72,255,49,113,87,108,86,103,149,80,19,243,124,109,38,155,180,155,73,23,210,15,100,188,186,35,231,88,217,173,108,75,145,198,238,165,187,235,222,92,11,233,239,197,85,119,208,189,169,230,194,223,139,233,75,245,49,77,116,51,187,67,246,252,172,184,115,70,138,99,206,117,37,254,128,158,186,102,27,189,222,166,171,55,247,27,239,139,114,112,180,160,37,154,30,10,183,232,131,232,124,126,213,87,243,7,56,253,226,179,242,112,5,155,223,129,226,36,239,163,126,253,117,23,29,16,223,255,19,147,68,194,179,
|
||||
|
||||
|
|
@ -10,16 +10,11 @@ topic "Algorithms";
|
|||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[{_}%EN-US
|
||||
[ {{10000@(113.42.0) [s0; [*@7;4 Algorithms]]}}&]
|
||||
[s9; A number of generic algorithms.&]
|
||||
[ {{10000@(113.42.0) [s0; [*@7;4 Algorithmic templates]]}}&]
|
||||
[s3; &]
|
||||
[s0; &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Global Functions]]}}&]
|
||||
[s3;%- &]
|
||||
[s5;:Swap`(T`&`,T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[@(0.0.255) v
|
||||
oid]_[* Swap]([*@4 T][@(0.0.255) `&]_[*@3 a], [*@4 T][@(0.0.255) `&]_[*@3 b])&]
|
||||
[s2; Swaps values. Specific types might specialize [* Swap] with more
|
||||
effective variants.&]
|
||||
[s2; Swaps values. Specific types might specialize [* Swap].&]
|
||||
[s6; T must have either deep copy operator or pick operator.&]
|
||||
[s7; [*C@4 T]-|Type of values.&]
|
||||
[s7; [*C@3 a]-|First value to swap.&]
|
||||
|
|
@ -29,29 +24,12 @@ effective variants.&]
|
|||
[s5;:IterSwap`(I`,I`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 I][@(0.0.255) >]_[@(0.0.255) v
|
||||
oid]_[* IterSwap]([*@4 I]_[*@3 a], [*@4 I]_[*@3 b])&]
|
||||
[s2; Swaps values pointed to by iterators. Specific types might specialize
|
||||
[* IterSwap] with more effective variants.&]
|
||||
[* IterSwap].&]
|
||||
[s6; Swap must be defined for type pointed to by I.&]
|
||||
[s7; [*C@4 I]-|Iterator type.&]
|
||||
[s7; [*C@3 a]-|Iterator pointing to first value.&]
|
||||
[s7; [*C@3 b]-|Iterator pointing to second value. xx&]
|
||||
[s3;%- &]
|
||||
[s4; &]
|
||||
[s5;:FindLowerBound`(const C`&`,int`,int`,const T`&`,const L`&`):%- [@(0.0.255) templat
|
||||
e]_<[@(0.0.255) class]_[*@4 C], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 L][@(0.0.255) >
|
||||
]_[@(0.0.255) int]_[* FindLowerBound]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v],
|
||||
[@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 count], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&
|
||||
]_[*@3 val], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Finds first position in range of container sorted by [* less]
|
||||
predicate where [* val] can be inserted without breaking the ordering.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 pos]-|Beginning of range.&]
|
||||
[s7; [*C@3 count]-|Number of elements in range.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:sgn`(T`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) int]_[* sgn]([*@4 T
|
||||
]_[*@3 a])&]
|
||||
|
|
@ -80,20 +58,101 @@ and ends in [%-*@3 end].&]
|
|||
[s5;:Sum`(V`&`,T`,T`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T],
|
||||
[@(0.0.255) class]_[*@4 V]>_[@(0.0.255) void]_[* Sum]([*@4 V][@(0.0.255) `&]_[*@3 sum],
|
||||
[*@4 T]_[*@3 ptr], [*@4 T]_[*@3 end])&]
|
||||
[s2; Returns in [%-*@3 sum] the sum of the values of a C array that
|
||||
begins in [%-*@3 ptr] and ends in [%-*@3 end].&]
|
||||
[s2;%- [%% Returns in ][*@3 sum][%% the sum of the values of a C array
|
||||
that begins in ][*@3 ptr][%% and ends in ][*@3 end][%% . ][*@4 T]_must
|
||||
have defined operator`+`= and deep copy constructor.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:MinElement`(T`,T`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[*@4 T]_[* MinEle
|
||||
ment]([*@4 T]_[*@3 ptr], [*@4 T]_[*@3 end])&]
|
||||
[s2; Returns the value of the min element of a C array that begins
|
||||
in [%-*@3 ptr] and ends in [%-*@3 end].&]
|
||||
[s5;:Sum`(const T`&`,const typename ValueType`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 T]>_[@(0.0.255) typename]_[_^ValueType^ T`::ValueType]_[* Sum]([@(0.0.255) const]_
|
||||
[*@4 T][@(0.0.255) `&]_[*@3 c], [@(0.0.255) const]_[@(0.0.255) typename]_[_^ValueType^ T`::Val
|
||||
ueType][@(0.0.255) `&]_[*@3 zero])&]
|
||||
[s2;%- [%% Returns the sum of all elements in container ][*@3 c][%% , with
|
||||
][*@3 zero][%% representing zero value. ][*@4 T]_must have defined
|
||||
operator`+`= and deep copy constructor.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:MaxElement`(T`,T`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[*@4 T]_[* MaxEle
|
||||
ment]([*@4 T]_[*@3 ptr], [*@4 T]_[*@3 end])&]
|
||||
[s2; Returns the value of the max element of a C array that begins
|
||||
in [%-*@3 ptr] and ends in [%-*@3 end].&]
|
||||
[s5;:Sum`(const T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) typen
|
||||
ame]_[_^ValueType^ T`::ValueType]_[* Sum]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2; Same as Sum(c, 0).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindMin`(const C`&`,int`,int`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[@(0.0.255) i
|
||||
nt]_[* FindMin]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c], [@(0.0.255) int]_[*@3 pos],
|
||||
[@(0.0.255) int]_[*@3 count])&]
|
||||
[s2; Finds the index of minumum value of [%-*@3 c], in [%-*@3 count ]elements
|
||||
starting at [%-*@3 pos]. Elements must have operator< defined.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindMin`(const C`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[@(0.0.255) i
|
||||
nt]_[* FindMin]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2; Same as FindMin(c, 0, c.GetCount()).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Min`(const C`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[@(0.0.255) int]_
|
||||
[* Min]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2; Returns the minumum element of [%-*@3 c]. If [%-*@3 c] is empty,
|
||||
behaviour is undefined (ASSERT in debug mode).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Min`(const C`&`,const typename ValueType`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 C]>_[@(0.0.255) int]_[* Min]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c],
|
||||
[@(0.0.255) const]_[@(0.0.255) typename]_[_^ValueType^ C`::ValueType][@(0.0.255) `&]_[*@3 de
|
||||
f])&]
|
||||
[s2; Returns the minumum element of [%-*@3 c]. If [%-*@3 c] is empty,
|
||||
returns [%-*@3 def].&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindMax`(const C`&`,int`,int`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[@(0.0.255) i
|
||||
nt]_[* FindMax]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c], [@(0.0.255) int]_[*@3 pos],
|
||||
[@(0.0.255) int]_[*@3 count])&]
|
||||
[s2; Finds the index of maximum value of [%-*@3 c], in [%-*@3 count ]elements
|
||||
starting at [%-*@3 pos]. Elements must have operator> defined.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindMax`(const C`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[@(0.0.255) i
|
||||
nt]_[* FindMax]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2; Same as FindMax(c, 0, c.GetCount()).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Max`(const C`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[@(0.0.255) int]_
|
||||
[* Max]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2; Returns the maximum element of [%-*@3 c]. If [%-*@3 c] is empty,
|
||||
behaviour is undefined (ASSERT in debug mode).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Max`(const C`&`,const typename ValueType`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 C]>_[@(0.0.255) int]_[* Max]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c],
|
||||
[@(0.0.255) const]_[@(0.0.255) typename]_[_^ValueType^ C`::ValueType][@(0.0.255) `&]_[*@3 de
|
||||
f])&]
|
||||
[s2; Returns the maximum element of [%-*@3 c]. If [%-*@3 c] is empty,
|
||||
returns [%-*@3 def].&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindIndex`(const T`&`,const V`&`,const C`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 T], [@(0.0.255) class]_[*@4 V], [@(0.0.255) class]_[*@4 C]>_[@(0.0.255) int]_[* Find
|
||||
Index]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 cont], [@(0.0.255) const]_[*@4 V][@(0.0.255) `&
|
||||
]_[*@3 value], [@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 equal])&]
|
||||
[s2; Performs a linear search of [%-*@3 cont] to find an index of element
|
||||
with [%-*@3 value]. using predicate [%-*@3 equal] to perform comparisons.
|
||||
If not found, returns `-1.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindIndex`(const T`&`,const V`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T],
|
||||
[@(0.0.255) class]_[*@4 V]>_[@(0.0.255) int]_[* FindIndex]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&
|
||||
]_[*@3 cont], [@(0.0.255) const]_[*@4 V][@(0.0.255) `&]_[*@3 value])&]
|
||||
[s2; Performs a linear search of [%-*@3 cont] to find an index of element
|
||||
with [%-*@3 value]. If not found, returns `-1.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:FindLowerBound`(const C`&`,int`,int`,const T`&`,const L`&`):%- [@(0.0.255) templat
|
||||
e]_<[@(0.0.255) class]_[*@4 C], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 L][@(0.0.255) >
|
||||
]_[@(0.0.255) int]_[* FindLowerBound]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v],
|
||||
[@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 count], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&
|
||||
]_[*@3 val], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Finds the first index in range of container [%-*@3 v ]sorted by
|
||||
[%-*@3 less ]predicate where [%-*@3 val] can be inserted without
|
||||
breaking the ordering.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:FindLowerBound`(const C`&`,const T`&`,const L`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
|
|
@ -101,26 +160,17 @@ lass]_[*@4 C], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 L][@(0.0.255)
|
|||
nt]_[* FindLowerBound]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v],
|
||||
[@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 val], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_
|
||||
[*@3 less])&]
|
||||
[s2; Finds first position in sorted by [* less] predicate where [* val]
|
||||
can be inserted without breaking the ordering.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the first index in container [%-*@3 v] sorted by [%-*@3 less]
|
||||
predicate where [%-*@3 val] can be inserted without breaking the
|
||||
ordering.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindLowerBound`(const C`&`,const T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 C], [@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[@(0.0.255) int]_[* FindLowerBound]([@(0.0.255) c
|
||||
onst]_[*@4 C][@(0.0.255) `&]_[*@3 v], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 val])&]
|
||||
[s2; Finds first position in sorted by [*/ operator<] predicate where
|
||||
[* val] can be inserted without breaking the ordering.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the first index in container [%-*@3 v] sorted by [*/ operator<]
|
||||
predicate where [%-*@3 val] can be inserted without breaking the
|
||||
ordering.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindUpperBound`(const C`&`,int`,int`,const T`&`,const L`&`):%- [@(0.0.255) templat
|
||||
|
|
@ -128,16 +178,9 @@ e]_<[@(0.0.255) class]_[*@4 C], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[
|
|||
]_[@(0.0.255) int]_[* FindUpperBound]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v],
|
||||
[@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 count], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&
|
||||
]_[*@3 val], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Finds last position in range of container sorted by [* less] predicate
|
||||
where [* val] can be inserted without breaking the ordering.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 pos]-|Beginning of range.&]
|
||||
[s7; [*C@3 count]-|Number of elements in range.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the last index in range of container [%-*@3 v ]sorted by
|
||||
[%-*@3 less ]predicate where [%-*@3 val] can be inserted without
|
||||
breaking the ordering.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindUpperBound`(const C`&`,const T`&`,const L`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
|
|
@ -145,26 +188,17 @@ lass]_[*@4 C], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 L][@(0.0.255)
|
|||
nt]_[* FindUpperBound]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v],
|
||||
[@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 val], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_
|
||||
[*@3 less])&]
|
||||
[s2; Finds last position in sorted by [* less] predicate where [* val]
|
||||
can be inserted without breaking the ordering.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the last index in container [%-*@3 v] sorted by [%-*@3 less]
|
||||
predicate where [%-*@3 val] can be inserted without breaking the
|
||||
ordering.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindUpperBound`(const C`&`,const T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 C], [@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[@(0.0.255) int]_[* FindUpperBound]([@(0.0.255) c
|
||||
onst]_[*@4 C][@(0.0.255) `&]_[*@3 v], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 val])&]
|
||||
[s2; Finds last position in sorted by [*/ operator<] predicate where
|
||||
[* val] can be inserted without breaking the ordering.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the last index in container [%-*@3 v] sorted by [*/ operator<]
|
||||
predicate where [%-*@3 val] can be inserted without breaking the
|
||||
ordering.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindBinary`(const C`&`,const T`&`,int`,int`,const L`&`):%- [@(0.0.255) template]_<
|
||||
|
|
@ -172,45 +206,26 @@ onst]_[*@4 C][@(0.0.255) `&]_[*@3 v], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_
|
|||
]_[@(0.0.255) int]_[* FindBinary]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v],
|
||||
[@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 val], [@(0.0.255) int]_[*@3 pos],
|
||||
[@(0.0.255) int]_[*@3 count], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Finds position of element with specified value in a range of
|
||||
container sorted by [* less] predicate. If no such element exists,
|
||||
a negative value is returned.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 pos]-|Beginning of range.&]
|
||||
[s7; [*C@3 count]-|Number of elements in range.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the first position of element with specified value [%-*@3 val]
|
||||
in range of container [%-*@3 v] sorted by [%-*@3 less] predicate.
|
||||
If no such element exists, a negative value is returned.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindBinary`(const C`&`,const T`&`,const L`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 C], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 L][@(0.0.255) >]_[@(0.0.255) i
|
||||
nt]_[* FindBinary]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 v], [@(0.0.255) const]_[*@4 T
|
||||
][@(0.0.255) `&]_[*@3 val], [@(0.0.255) const]_[*@4 L][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Finds position of element with specified value in the container
|
||||
sorted by [* less] predicate. If no such element exists, a negative
|
||||
value is returned.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the first position of element with specified value [%-*@3 val]
|
||||
in container [%-*@3 v] sorted by [%-*@3 less] predicate. If no such
|
||||
element exists, a negative value is returned.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FindBinary`(const C`&`,const T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C
|
||||
], [@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[@(0.0.255) int]_[* FindBinary]([@(0.0.255) const
|
||||
]_[*@4 C][@(0.0.255) `&]_[*@3 v], [@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 val])&]
|
||||
[s2; Finds position of element with specified value in the container
|
||||
sorted by [*/ operator<] predicate. If no such element exists,
|
||||
a negative value is returned.&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@4 T]-|Type of value.&]
|
||||
[s7; [*C@3 v]-|Container.&]
|
||||
[s7; [*C@3 val]-|Value to find.&]
|
||||
[s7; [*/ Return value]-|Position in container.&]
|
||||
[s2; Finds the first position of element with specified value [%-*@3 val]
|
||||
in container [%-*@3 v] sorted by [%-* operator<]. If no such element
|
||||
exists, a negative value is returned.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:AppendSorted`(C`&`,const C`&`,const L`&`):%- [@(0.0.255) template]_<[@(0.0.255) clas
|
||||
|
|
@ -324,173 +339,4 @@ order and values must be unique. Ordering is determined by [*/ operator<].&]
|
|||
[s7; [*C@3 dest]-|Destination container.&]
|
||||
[s7; [*C@3 src]-|Source container.&]
|
||||
[s7; [*/ Return value]-|Destination container.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Sort`(T`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T],
|
||||
[@(0.0.255) class]_[*@4 Less][@(0.0.255) >]_[@(0.0.255) void]_[* Sort]([*@4 T][@(0.0.255) `&]_[*@3 c
|
||||
], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Sorts container. Ordering is determined by [* less].&]
|
||||
[s6; IterSwap must be defined for T`::Iterator.&]
|
||||
[s7; [*C@4 T]-|Type of container.&]
|
||||
[s7; [*C@3 c]-|Container.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Sort`(T`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[@(0.0.255) v
|
||||
oid]_[* Sort]([*@4 T][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2; Sorts container. Ordering is determined by [*/ operator<].&]
|
||||
[s2; [*1 IterSwap must be defined for T`::Iterator.]&]
|
||||
[s7; [*C@4 T]-|Type of container.&]
|
||||
[s7; [*C@3 c]-|Container.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:IndexSort`(KC`&`,VC`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 K
|
||||
C], [@(0.0.255) class]_[*@4 VC], [@(0.0.255) class]_[*@4 Less][@(0.0.255) >]_[@(0.0.255) void
|
||||
]_[* IndexSort]([*@4 KC][@(0.0.255) `&]_[*@3 keys], [*@4 VC][@(0.0.255) `&]_[*@3 values],
|
||||
[@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Sorts pair of containers. Both containers must have same number
|
||||
of items. Resulting order is determined by the [* keys] container.
|
||||
Ordering is determined by [* less].&]
|
||||
[s7; [*C@4 KC]-|Type of keys container.&]
|
||||
[s7; [*C@4 VC]-|Type of values.&]
|
||||
[s7; [*C@3 keys]-|Container of keys.&]
|
||||
[s7; [*C@3 values]-|Container of values.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:IndexSort`(KC`&`,VC`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 KC],
|
||||
[@(0.0.255) class]_[*@4 VC][@(0.0.255) >]_[@(0.0.255) void]_[* IndexSort]([*@4 KC][@(0.0.255) `&
|
||||
]_[*@3 keys], [*@4 VC][@(0.0.255) `&]_[*@3 values])&]
|
||||
[s2; Sorts pair of containers. Both containers must have same number
|
||||
of items. Resulting order is determined by the [* keys] container.
|
||||
Ordering is determined by [*/ operator<].&]
|
||||
[s7; [*C@4 KC]-|Type of keys container.&]
|
||||
[s7; [*C@4 VC]-|Type of values container.&]
|
||||
[s7; [*C@3 keys]-|Container of keys.&]
|
||||
[s7; [*C@3 values]-|Container of values.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:GetSortOrder`(const C`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 C], [@(0.0.255) class]_[*@4 Less][@(0.0.255) >]_Vector[@(0.0.255) <int>]_[* GetSortOrder
|
||||
]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 container], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&
|
||||
]_[*@3 less])&]
|
||||
[s2; Creates ascending order of values in container. Ordering is
|
||||
determined by [* less].&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@3 container]-|Source container.&]
|
||||
[s7; [*C@3 less]-|Ordering predicate.&]
|
||||
[s7; [*/ Return value]-|Vector of positions of source container in sorted
|
||||
order.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:GetSortOrder`(const C`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C][@(0.0.255) >
|
||||
]_Vector[@(0.0.255) <int>]_[* GetSortOrder]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 co
|
||||
ntainer])&]
|
||||
[s2; Creates ascending order of values in container. Ordering is
|
||||
determined by [*/ operator<].&]
|
||||
[s7; [*C@4 C]-|Type of container.&]
|
||||
[s7; [*C@3 container]-|Source container.&]
|
||||
[s7; [*/ Return value]-|Vector of positions of source container in sorted
|
||||
order.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:FieldRelation`(O`(`*`)`,const R`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 O
|
||||
], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 R][@(0.0.255) >]_FieldRelationCls[@(0.0.255) <
|
||||
][*@4 O], [*@4 T], [*@4 R][@(0.0.255) >]_[* FieldRelation]([*@4 O]_(T`::[@(0.0.255) `*][*@3 member
|
||||
]), [@(0.0.255) const]_[*@4 R][@(0.0.255) `&]_[*@3 relation])&]
|
||||
[s2; Creates ordering predicate for [* T] based on the value of member
|
||||
variable of[* T].&]
|
||||
[s7; [*C@4 T]-|Type of element.&]
|
||||
[s7; [*C@3 member]-|Member variable of T.&]
|
||||
[s7; [*C@3 relation]-|Ordering relation for [* member].&]
|
||||
[s7; [*/ Return value]-|Ordering predicate.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:MethodRelation`(O`(`*`)`(`)`,const R`&`):%- [@(0.0.255) template]_<[@(0.0.255) class
|
||||
]_[*@4 O], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 R][@(0.0.255) >]_MethodRelatio
|
||||
nCls[@(0.0.255) <][*@4 O]_(T`::[@(0.0.255) `*])(), [*@4 T], [*@4 R][@(0.0.255) >]_[* MethodRelat
|
||||
ion]([*@4 O]_(T`::[@(0.0.255) `*][*@3 method])(), [@(0.0.255) const]_[*@4 R][@(0.0.255) `&]_[*@3 r
|
||||
elation])&]
|
||||
[s2; Creates ordering predicate for [* T] based on the value returned
|
||||
by non`-const method of [* T].&]
|
||||
[s7; [*C@4 T]-|Type of element.&]
|
||||
[s7; [*C@3 method]-|Method of T.&]
|
||||
[s7; [*C@3 relation]-|Ordering relation for value returned by method.&]
|
||||
[s7; [*/ Return value]-|Ordering predicate.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:MethodRelation`(O`(`*`)`(`)const`,const R`&`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 O], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 R][@(0.0.255) >]_MethodRel
|
||||
ationCls[@(0.0.255) <][*@4 O]_(T`::[@(0.0.255) `*])()_[@(0.0.255) const],
|
||||
[*@4 T], [*@4 R][@(0.0.255) >]_[* MethodRelation]([*@4 O]_(T`::[@(0.0.255) `*][*@3 method])()_[@(0.0.255) c
|
||||
onst], [@(0.0.255) const]_[*@4 R][@(0.0.255) `&]_[*@3 relation])&]
|
||||
[s2; Creates ordering predicate for [* T] based on the value returned
|
||||
by const method of [* T].&]
|
||||
[s7; [*C@4 T]-|Type of element.&]
|
||||
[s7; [*C@3 method]-|Method of T.&]
|
||||
[s7; [*C@3 relation]-|Ordering relation for value returned by method.&]
|
||||
[s7; [*/ Return value]-|Ordering predicate.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:SortByKey`(Map`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map
|
||||
], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* SortByKey]([*@4 Map][@(0.0.255) `&]_[*@3 m
|
||||
ap], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using [%-*@3 less]
|
||||
as sorting predicate.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:SortByKey`(Map`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* SortByKey]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using operator<
|
||||
as sorting predicate.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:SortByValue`(Map`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 M
|
||||
ap], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* SortByValue]([*@4 Map][@(0.0.255) `&
|
||||
]_[*@3 map], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
[%-*@3 less] as sorting predicate.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:SortByValue`(Map`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* SortByValue]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
operator< as sorting predicate.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:StableSortByKey`(Map`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 Map], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* StableSortByKey]([*@4 Map][@(0.0.255) `&
|
||||
]_[*@3 map], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using [%-*@3 less]
|
||||
as sorting predicate. Stable: retains the order of equal elements.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:StableSortByKey`(Map`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* StableSortByKey]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using operator<
|
||||
as sorting predicate. Stable: retains the order of equal elements.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:StableSortByValue`(Map`&`,const Less`&`):%- [@(0.0.255) template]_<[@(0.0.255) class
|
||||
]_[*@4 Map], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* StableSortByValue]([*@4 Map][@(0.0.255) `&
|
||||
]_[*@3 map], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
[%-*@3 less] as sorting predicate. Stable: retains the order of
|
||||
equal elements.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:StableSortByValue`(Map`&`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* StableSortByValue]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2; Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
operator< as sorting predicate. Stable: retains the order of equal
|
||||
elements.&]
|
||||
[s3; &]
|
||||
[s0; ]]
|
||||
212
uppsrc/Core/src.tpp/algo_sort$en-us.tpp
Normal file
212
uppsrc/Core/src.tpp/algo_sort$en-us.tpp
Normal file
|
|
@ -0,0 +1,212 @@
|
|||
topic "";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
[H6;0 $$4,0#05600065144404261032431302351956:begin]
|
||||
[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item]
|
||||
[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement]
|
||||
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
|
||||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[{_}
|
||||
[ {{10000@(113.42.0) [s0;%% [*@7;4 Sorting template functions]]}}&]
|
||||
[s3; &]
|
||||
[s5;:Sort`(T`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T],
|
||||
[@(0.0.255) class]_[*@4 Less][@(0.0.255) >]_[@(0.0.255) void]_[* Sort]([*@4 T][@(0.0.255) `&]_[*@3 c
|
||||
], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts container [%-*@3 c] with ordering is defined by [%-*@3 less].
|
||||
The order of elements with the same value can be changed (unstable
|
||||
sort).&]
|
||||
[s6;%% IterSwap must be defined for T`::Iterator.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Sort`(T`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T][@(0.0.255) >]_[@(0.0.255) v
|
||||
oid]_[* Sort]([*@4 T][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2;%% Sorts container [%-*@3 c] with ordering is determined by [*/ operator<].
|
||||
The order of elements with the same value can be changed (unstable
|
||||
sort).&]
|
||||
[s6;%% IterSwap must be defined for T`::Iterator.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:StableSort`(T`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T],
|
||||
[@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* StableSort]([*@4 T][@(0.0.255) `&]_[*@3 c],
|
||||
[@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts container [%-*@3 c] with ordering is defined by [%-*@3 less].
|
||||
The order of elements with the same value stays unchanged (stable
|
||||
sort).&]
|
||||
[s6;%% IterSwap must be defined for T`::Iterator.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:StableSort`(T`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T]>_[@(0.0.255) void]_
|
||||
[* StableSort]([*@4 T][@(0.0.255) `&]_[*@3 c])&]
|
||||
[s2;%% Sorts container [%-*@3 c] with ordering is determined by [*/ operator<].
|
||||
The order of elements with the same value stays unchanged (stable
|
||||
sort).&]
|
||||
[s6;%% IterSwap must be defined for T`::Iterator.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:IndexSort`(KC`&`,VC`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 K
|
||||
C], [@(0.0.255) class]_[*@4 VC], [@(0.0.255) class]_[*@4 Less][@(0.0.255) >]_[@(0.0.255) void
|
||||
]_[* IndexSort]([*@4 KC][@(0.0.255) `&]_[*@3 keys], [*@4 VC][@(0.0.255) `&]_[*@3 values],
|
||||
[@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts pair of containers. Both containers must have same number
|
||||
of items. Resulting order is defined by the [* keys] container.
|
||||
Ordering is defined by [* less].&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:IndexSort`(KC`&`,VC`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 KC],
|
||||
[@(0.0.255) class]_[*@4 VC][@(0.0.255) >]_[@(0.0.255) void]_[* IndexSort]([*@4 KC][@(0.0.255) `&
|
||||
]_[*@3 keys], [*@4 VC][@(0.0.255) `&]_[*@3 values])&]
|
||||
[s2;%% Sorts pair of containers. Both containers must have same number
|
||||
of items. Resulting order is determined by the [* keys] container.
|
||||
Ordering is determined by [*/ operator<].&]
|
||||
[s7;%% [*C@4 KC]-|Type of keys container.&]
|
||||
[s7;%% [*C@4 VC]-|Type of values container.&]
|
||||
[s7;%% [*C@3 keys]-|Container of keys.&]
|
||||
[s7;%% [*C@3 values]-|Container of values.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:GetSortOrder`(const C`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C
|
||||
], [@(0.0.255) class]_[*@4 Less][@(0.0.255) >]_Vector[@(0.0.255) <int>]_[* GetSortOrder]([@(0.0.255) c
|
||||
onst]_[*@4 C][@(0.0.255) `&]_[*@3 container], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 l
|
||||
ess])&]
|
||||
[s2;%% Creates ascending order of values in [%-*@3 container]. Ordering
|
||||
is determined by [%-*@3 less]. The order of elements with the same
|
||||
value can be changed (unstable sort).&]
|
||||
[s7;%% [*C@4 C]-|Type of container.&]
|
||||
[s7;%% [*C@3 container]-|Source container.&]
|
||||
[s7;%% [*C@3 less]-|Ordering predicate.&]
|
||||
[s7;%% [*/ Return value]-|Vector of positions of source container in
|
||||
sorted order.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:GetSortOrder`(const C`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C][@(0.0.255) >
|
||||
]_Vector[@(0.0.255) <int>]_[* GetSortOrder]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 co
|
||||
ntainer])&]
|
||||
[s2;%% Creates ascending order of values in [%-*@3 container]. Ordering
|
||||
is determined by [*/ operator<]. The order of elements with the
|
||||
same value can be changed (unstable sort).&]
|
||||
[s7;%% [*C@4 C]-|Type of container.&]
|
||||
[s7;%% [*C@3 container]-|Source container.&]
|
||||
[s7;%% [*/ Return value]-|Vector of positions of source container in
|
||||
sorted order.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:GetStableSortOrder`(const C`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) cl
|
||||
ass]_[*@4 C], [@(0.0.255) class]_[*@4 Less]>_[_^Vector^ Vector]<[@(0.0.255) int]>_[* GetStabl
|
||||
eSortOrder]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 container],
|
||||
[@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Creates ascending order of values in [%-*@3 container]. Ordering
|
||||
is determined by [%-*@3 less]. The order of elements with the same
|
||||
value stays unchanged (stable sort).&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:GetStableSortOrder`(const C`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>_[_^Vector^ V
|
||||
ector]<[@(0.0.255) int]>_[* GetStableSortOrder]([@(0.0.255) const]_[*@4 C][@(0.0.255) `&]_[*@3 c
|
||||
ontainer])&]
|
||||
[s2;%% Creates ascending order of values in [%-*@3 container]. Ordering
|
||||
is determined by [*/ operator<]. The order of elements with the
|
||||
same value stays unchanged (stable sort).&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:FieldRelation`(O`(`*`)`,const R`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 O],
|
||||
[@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 R][@(0.0.255) >]_FieldRelationCls[@(0.0.255) <
|
||||
][*@4 O], [*@4 T], [*@4 R][@(0.0.255) >]_[* FieldRelation]([*@4 O]_(T`::[@(0.0.255) `*][*@3 member
|
||||
]), [@(0.0.255) const]_[*@4 R][@(0.0.255) `&]_[*@3 relation])&]
|
||||
[s2;%% Creates ordering predicate for [* T] based on the value of member
|
||||
variable of[* T].&]
|
||||
[s7;%% [*C@4 T]-|Type of element.&]
|
||||
[s7;%% [*C@3 member]-|Member variable of T.&]
|
||||
[s7;%% [*C@3 relation]-|Ordering relation for [* member].&]
|
||||
[s7;%% [*/ Return value]-|Ordering predicate.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:MethodRelation`(O`(`*`)`(`)`,const R`&`): [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 O], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 R][@(0.0.255) >]_MethodRelationC
|
||||
ls[@(0.0.255) <][*@4 O]_(T`::[@(0.0.255) `*])(), [*@4 T], [*@4 R][@(0.0.255) >]_[* MethodRelatio
|
||||
n]([*@4 O]_(T`::[@(0.0.255) `*][*@3 method])(), [@(0.0.255) const]_[*@4 R][@(0.0.255) `&]_[*@3 r
|
||||
elation])&]
|
||||
[s2;%% Creates ordering predicate for [* T] based on the value returned
|
||||
by non`-const method of [* T].&]
|
||||
[s7;%% [*C@4 T]-|Type of element.&]
|
||||
[s7;%% [*C@3 method]-|Method of T.&]
|
||||
[s7;%% [*C@3 relation]-|Ordering relation for value returned by method.&]
|
||||
[s7;%% [*/ Return value]-|Ordering predicate.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:MethodRelation`(O`(`*`)`(`)const`,const R`&`): [@(0.0.255) template]_<[@(0.0.255) cl
|
||||
ass]_[*@4 O], [@(0.0.255) class]_[*@4 T], [@(0.0.255) class]_[*@4 R][@(0.0.255) >]_MethodRela
|
||||
tionCls[@(0.0.255) <][*@4 O]_(T`::[@(0.0.255) `*])()_[@(0.0.255) const],
|
||||
[*@4 T], [*@4 R][@(0.0.255) >]_[* MethodRelation]([*@4 O]_(T`::[@(0.0.255) `*][*@3 method])()_[@(0.0.255) c
|
||||
onst], [@(0.0.255) const]_[*@4 R][@(0.0.255) `&]_[*@3 relation])&]
|
||||
[s2;%% Creates ordering predicate for [* T] based on the value returned
|
||||
by const method of [* T].&]
|
||||
[s7;%% [*C@4 T]-|Type of element.&]
|
||||
[s7;%% [*C@3 method]-|Method of T.&]
|
||||
[s7;%% [*C@3 relation]-|Ordering relation for value returned by method.&]
|
||||
[s7;%% [*/ Return value]-|Ordering predicate.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:SortByKey`(Map`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map],
|
||||
[@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* SortByKey]([*@4 Map][@(0.0.255) `&]_[*@3 m
|
||||
ap], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using [%-*@3 less]
|
||||
as sorting predicate.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:SortByKey`(Map`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) voi
|
||||
d]_[* SortByKey]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using operator<
|
||||
as sorting predicate.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:SortByValue`(Map`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map
|
||||
], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* SortByValue]([*@4 Map][@(0.0.255) `&]_
|
||||
[*@3 map], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
[%-*@3 less] as sorting predicate.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:SortByValue`(Map`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* SortByValue]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
operator< as sorting predicate.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:StableSortByKey`(Map`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 M
|
||||
ap], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* StableSortByKey]([*@4 Map][@(0.0.255) `&
|
||||
]_[*@3 map], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using [%-*@3 less]
|
||||
as sorting predicate. Stable: retains the order of equal elements.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:StableSortByKey`(Map`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* StableSortByKey]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by keys, using operator<
|
||||
as sorting predicate. Stable: retains the order of equal elements.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:StableSortByValue`(Map`&`,const Less`&`): [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 Map], [@(0.0.255) class]_[*@4 Less]>_[@(0.0.255) void]_[* StableSortByValue]([*@4 Map][@(0.0.255) `&
|
||||
]_[*@3 map], [@(0.0.255) const]_[*@4 Less][@(0.0.255) `&]_[*@3 less])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
[%-*@3 less] as sorting predicate. Stable: retains the order of
|
||||
equal elements.&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:StableSortByValue`(Map`&`): [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 Map]>_[@(0.0.255) v
|
||||
oid]_[* StableSortByValue]([*@4 Map][@(0.0.255) `&]_[*@3 map])&]
|
||||
[s2;%% Sorts VectorMap or ArrayMap (or any other hypothetical container
|
||||
that supports required interfaces) [%-*@3 map] by values, using
|
||||
operator< as sorting predicate. Stable: retains the order of equal
|
||||
elements.&]
|
||||
[s3;%% &]
|
||||
[s0;%% ]]
|
||||
10
uppsrc/Core/src.tpp/algo_sort$en-us.tppi
Normal file
10
uppsrc/Core/src.tpp/algo_sort$en-us.tppi
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
TITLE("")
|
||||
COMPRESSED
|
||||
120,156,237,90,109,111,218,72,16,254,43,43,165,173,32,2,186,187,182,177,49,85,149,43,167,187,171,114,85,164,20,229,11,114,131,129,165,88,5,155,218,38,61,212,180,191,253,102,118,141,49,175,5,31,36,8,93,20,197,216,158,247,231,153,221,177,73,139,147,23,47,104,137,94,208,95,252,216,191,139,190,59,25,198,78,203,211,117,171,238,114,163,254,229,250,166,86,71,125,6,250,154,201,52,203,208,152,206,171,240,135,105,140,27,92,211,153,197,107,186,165,105,22,181,187,67,55,138,156,214,144,91,150,84,226,37,126,193,77,131,51,83,183,116,139,105,166,197,65,151,83,202,169,201,13,166,107,22,55,236,158,136,186,78,139,130,184,6,62,106,85,173,70,25,165,38,99,84,227,38,213,12,157,49,141,131,9,110,114,70,13,91,248,61,167,245,87,181,142,10,58,38,101,84,33,244,42,88,211,117,10,214,81,77,215,152,70,185,102,176,154,81,181,59,226,179,231,175,75,201,248,101,74,38,181,189,88,140,146,140,92,189,126,121,101,212,25,168,86,75,213,11,19,220,234,6,
|
||||
56,171,97,70,26,168,113,94,53,106,204,208,33,36,157,114,59,20,95,39,94,40,70,194,143,19,11,30,99,156,213,59,204,172,67,8,63,127,254,172,48,157,170,74,153,16,11,163,16,55,103,112,13,242,48,153,81,163,53,195,98,22,213,76,157,27,38,164,62,118,67,119,148,100,210,209,121,61,201,195,42,89,23,85,86,133,138,82,11,226,55,106,96,128,66,18,112,132,66,26,240,171,89,118,156,40,163,30,42,213,74,181,11,40,146,102,80,179,70,77,221,52,116,200,132,179,42,131,66,82,204,31,96,176,253,32,28,185,67,167,245,253,254,7,105,145,239,223,25,178,228,170,0,128,84,116,94,161,69,210,138,104,253,229,75,210,186,188,50,235,58,249,24,132,177,231,127,38,80,178,241,208,141,5,233,79,252,110,236,5,126,228,56,63,126,188,114,90,145,86,39,120,48,234,54,202,182,11,205,246,171,118,169,11,2,49,249,91,68,17,156,21,109,210,186,42,208,10,173,64,38,197,212,148,115,255,38,123,89,17,237,30,252,234,164,233,148,200,166,123,104,212,201,222,124,11,
|
||||
55,50,167,15,129,215,67,81,25,186,83,72,236,101,37,218,175,164,41,141,116,151,221,96,212,155,220,164,90,67,188,83,196,156,57,22,10,221,68,168,26,187,158,47,66,210,122,89,86,182,201,55,47,30,144,32,236,137,16,43,232,69,164,39,250,32,210,35,157,233,76,74,218,170,144,230,64,40,65,18,244,137,24,74,126,69,74,63,134,91,145,59,18,228,193,29,78,4,233,186,62,233,192,97,224,250,159,193,82,97,2,17,187,157,33,200,64,24,197,10,70,85,197,168,222,199,34,252,248,205,29,147,209,4,128,0,141,153,239,126,16,146,102,219,182,81,192,141,131,176,146,193,80,95,3,101,30,240,14,133,78,206,34,67,102,163,180,206,151,175,73,48,86,169,190,57,137,74,131,202,82,173,165,217,39,108,158,183,27,16,73,227,56,187,174,1,228,166,17,129,149,107,6,230,113,154,102,9,200,60,208,253,103,108,142,208,51,207,95,232,149,158,121,239,247,196,63,170,210,215,13,236,153,187,198,1,58,231,186,177,165,117,238,182,221,220,121,83,74,3,79,112,4,151,107,129,
|
||||
252,34,166,17,250,75,60,175,149,145,37,143,14,215,141,99,215,147,8,167,148,137,42,228,93,0,32,207,47,40,192,6,238,67,130,186,63,25,117,20,45,112,168,2,249,91,17,193,180,137,180,82,132,89,236,95,100,11,20,65,38,55,183,90,33,55,27,218,253,50,105,245,181,237,182,158,3,135,71,253,153,96,125,50,116,178,173,191,27,64,91,22,11,12,218,84,243,99,67,213,161,252,216,156,142,5,6,129,86,51,70,151,68,239,178,162,170,6,155,132,147,58,150,31,27,233,226,150,152,95,150,75,106,185,36,169,174,174,103,213,159,34,198,122,203,132,219,5,181,160,28,98,109,217,119,245,184,19,93,168,104,246,226,27,207,143,223,74,182,101,99,4,194,109,232,254,13,244,74,107,122,136,133,163,17,10,72,59,34,110,212,133,135,184,57,177,230,16,122,126,186,241,164,142,183,242,233,120,131,113,134,108,89,174,109,36,217,60,224,242,227,199,96,18,118,197,102,89,25,111,249,49,205,107,28,138,158,215,133,218,100,5,95,67,3,198,147,208,87,33,131,184,2,25,131,24,
|
||||
7,145,39,31,171,240,36,90,114,134,69,196,52,32,47,89,140,253,152,155,135,171,79,79,198,163,114,234,152,15,1,199,98,213,129,201,178,50,66,33,110,233,84,249,244,203,29,12,186,247,159,84,74,159,136,58,58,11,214,128,96,40,164,8,182,24,232,255,107,222,174,211,246,222,184,231,65,250,153,160,60,205,21,99,23,76,150,16,249,195,19,195,222,173,128,58,67,79,183,11,55,237,66,251,178,93,156,181,224,109,46,84,110,182,244,223,182,23,4,183,203,75,255,66,112,141,97,180,176,9,56,115,95,169,225,181,86,0,251,5,67,201,152,124,227,220,23,240,113,111,1,233,75,71,2,61,18,56,188,58,197,205,29,123,187,158,33,225,204,199,42,65,130,149,237,89,62,113,66,116,77,135,116,220,8,215,76,95,34,170,192,4,176,85,24,112,30,122,18,199,160,15,210,32,190,188,246,55,51,107,127,66,144,229,149,63,201,168,252,248,97,197,38,105,46,11,167,89,100,134,138,217,181,89,208,137,193,173,187,198,134,137,100,133,132,31,68,60,8,214,176,176,112,50,76,92,
|
||||
140,112,19,21,215,18,170,88,40,238,66,209,69,15,59,113,20,21,18,243,207,198,210,80,34,174,22,46,31,176,43,43,184,84,112,72,46,169,153,139,176,50,61,36,236,204,212,254,60,93,141,81,153,61,54,107,101,17,206,130,186,247,171,212,58,50,155,215,123,60,9,130,159,49,183,87,191,25,128,153,225,221,244,90,76,219,133,15,238,248,0,83,57,88,201,251,229,192,44,148,132,71,104,105,45,236,163,85,23,249,223,72,170,97,18,124,1,101,200,111,97,232,78,241,115,1,78,92,127,74,2,96,72,72,6,211,49,126,136,161,146,195,204,83,80,60,112,99,18,77,198,99,105,40,249,222,182,135,163,168,8,251,110,87,68,197,217,68,136,17,35,116,248,254,168,68,38,17,66,147,157,200,97,172,148,211,91,62,200,242,129,116,8,20,78,166,152,233,32,157,163,146,119,216,52,167,66,127,25,204,249,54,128,122,86,58,80,11,44,0,119,132,38,216,25,139,19,42,105,206,70,72,159,152,79,101,47,88,12,232,124,27,98,191,29,33,169,139,141,243,0,120,140,228,0,51,
|
||||
127,105,240,117,2,209,204,94,29,236,137,245,97,251,103,127,248,78,6,133,95,116,208,161,33,56,149,221,103,57,164,243,109,185,125,247,160,163,34,126,180,182,59,195,205,43,63,16,242,223,13,29,231,95,218,163,49,79,
|
||||
|
||||
8
uppsrc/Core/src.tpp/all.i
Normal file
8
uppsrc/Core/src.tpp/all.i
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
TOPIC("MathUtil$en-us")
|
||||
#include "MathUtil$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
TOPIC("algo_sort$en-us")
|
||||
#include "algo_sort$en-us.tppi"
|
||||
END_TOPIC
|
||||
|
||||
|
|
@ -1984,13 +1984,6 @@ that are not found are ignored, those found are assigned correspoding
|
|||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Set`(int`,const ValueMap`&`):%- [@(0.0.255) void]_[* Set]([@(0.0.255) int
|
||||
]_[*@3 i], [@(0.0.255) const]_[_^ValueMap^ ValueMap][@(0.0.255) `&]_[*@3 m])&]
|
||||
[s2; Sets the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Add`(const VectorMap`<String`,Value`>`&`):%- [@(0.0.255) void]_[* Add](
|
||||
[@(0.0.255) const]_[_^VectorMap^ VectorMap]<[_^String^ String], [_^Value^ Value]>`&_[*@3 m])
|
||||
&]
|
||||
|
|
@ -1999,8 +1992,15 @@ that are not found are ignored, those found are assigned correspoding
|
|||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:Add`(const ValueMap`&`):%- [@(0.0.255) void]_[* Add]([@(0.0.255) const]_[_^ValueMap^ V
|
||||
alueMap][@(0.0.255) `&]_[*@3 m])&]
|
||||
[s5;:ArrayCtrl`:`:SetMap`(int`,const ValueMap`&`):%- [@(0.0.255) void]_[* SetMap]([@(0.0.255) i
|
||||
nt]_[*@3 i], [@(0.0.255) const]_[_^ValueMap^ ValueMap][@(0.0.255) `&]_[*@3 m])&]
|
||||
[s2; Sets the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:ArrayCtrl`:`:AddMap`(const ValueMap`&`):%- [@(0.0.255) void]_[* AddMap]([@(0.0.255) co
|
||||
nst]_[_^ValueMap^ ValueMap][@(0.0.255) `&]_[*@3 m])&]
|
||||
[s2; Adds the row based on map. Keys are matched to row Ids, keys
|
||||
that are not found are ignored, those found are assigned correspoding
|
||||
map values.&]
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ void Dasher::Line(const Pointf& p)
|
|||
void Dasher::Init(const Vector<double>& p, double distance)
|
||||
{
|
||||
pattern = &p;
|
||||
sum = Sum0(p);
|
||||
sum = Sum(p);
|
||||
if(sum == 0)
|
||||
return;
|
||||
distance -= int(distance / sum) * sum;
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ void RichEdit::MouseMove(Point p, dword flags)
|
|||
RichTable::Format fmt = text.GetTableFormat(tabmove.table);
|
||||
if(tabmove.column >= fmt.column.GetCount() - 1)
|
||||
return;
|
||||
int sum = Sum0(fmt.column);
|
||||
int sum = Sum(fmt.column);
|
||||
int nl = 0;
|
||||
for(int i = 0; i < tabmove.column; i++)
|
||||
nl += fmt.column[i];
|
||||
|
|
|
|||
|
|
@ -498,7 +498,7 @@ String AsQTF(const RichText& text, byte charset, dword options)
|
|||
RichPara p = text.Get(i);
|
||||
lngc.GetAdd(p.format.language, 0)++;
|
||||
}
|
||||
dword lang = lngc.GetCount() ? lngc.GetKey(MaxIndex(lngc.GetValues())) : 0;
|
||||
dword lang = lngc.GetCount() ? lngc.GetKey(FindMax(lngc.GetValues())) : 0;
|
||||
qtf << "[";
|
||||
if(!(options & QTF_NOCHARSET)) {
|
||||
qtf << "{";
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ void RichTable::Normalize()
|
|||
}
|
||||
else
|
||||
j++;
|
||||
int sum = Sum0(format.column);
|
||||
int sum = Sum(format.column);
|
||||
if(sum != 10000) {
|
||||
r_row = -1;
|
||||
if(format.column.GetCount()) {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ void RichTxt::Sync0(const Para& pp, int parti, const RichContext& rc) const
|
|||
pp.linecy.SetCount(pl.GetCount());
|
||||
for(int i = 0; i < pl.GetCount(); i++)
|
||||
pp.linecy[i] = pl[i].Sum();
|
||||
pp.cy = Sum0(pp.linecy);
|
||||
pp.cy = Sum(pp.linecy);
|
||||
pp.after = p.format.after;
|
||||
pp.newpage = p.format.newpage;
|
||||
pp.keep = p.format.keep;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue