mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Core: .docs
git-svn-id: svn://ultimatepp.org/upp/trunk@10466 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
ab8905daa3
commit
6797368fd8
6 changed files with 105 additions and 24 deletions
|
|
@ -97,9 +97,10 @@ public:
|
|||
|
||||
T& Add(const T& x, unsigned _hash);
|
||||
T& Add(const T& x);
|
||||
Index& operator<<(const T& x) { Add(x); return *this; }
|
||||
|
||||
int FindAdd(const T& key, unsigned _hash);
|
||||
int FindAdd(const T& key);
|
||||
Index& operator<<(const T& x) { Add(x); return *this; }
|
||||
|
||||
int Put(const T& x, unsigned _hash);
|
||||
int Put(const T& x);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
template <class Range>
|
||||
using ValueTypeOf = typename std::remove_reference<decltype(*((Range *)0)->begin())>::type;
|
||||
|
||||
template <class Range>
|
||||
using IteratorOf = decltype(((Range *)0)->begin());
|
||||
|
||||
template <class Range>
|
||||
using ConstIteratorOf = decltype(((const Range *)0)->begin());
|
||||
|
||||
template <class I>
|
||||
class SubRangeClass {
|
||||
I l;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ void FinalSort__(T& c, const Less& less)
|
|||
template <class T>
|
||||
void FinalSort__(T& c)
|
||||
{
|
||||
typedef typename T::ValueType VT;
|
||||
typedef ValueTypeOf<T> VT;
|
||||
FinalSort__(c.begin(), c.end(), std::less<VT>());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -347,18 +347,9 @@ public:
|
|||
void pop_back() { Drop(); } \
|
||||
|
||||
|
||||
template <class Range>
|
||||
using ValueTypeOf = typename std::remove_reference<decltype(*((Range *)0)->begin())>::type;
|
||||
|
||||
template <class Range>
|
||||
using ValueTypeOfArray = typename std::remove_reference<decltype((*((Range *)0))[0])>::type;
|
||||
|
||||
template <class Range>
|
||||
using IteratorOf = decltype(((Range *)0)->begin());
|
||||
|
||||
template <class Range>
|
||||
using ConstIteratorOf = decltype(((const Range *)0)->begin());
|
||||
|
||||
template <class V>
|
||||
class ConstIIterator {
|
||||
typedef ValueTypeOfArray<V> T;
|
||||
|
|
|
|||
|
|
@ -130,6 +130,11 @@ the element.&]
|
|||
[s6; Invalidates references to Index.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:Index`:`:operator`<`<`(const T`&`):%- [_^Upp`:`:Index^ Index][@(0.0.255) `&]_
|
||||
[* operator<<]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 x])&]
|
||||
[s2; Same as Add([%-*@3 x]).&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Index`:`:Find`(const T`&`,unsigned`)const:%- [@(0.0.255) int]_[* Find]([@(0.0.255) con
|
||||
st]_[*@4 T][@(0.0.255) `&]_[*@3 x], [@(0.0.255) unsigned]_[*@3 `_hash])_[@(0.0.255) const]&]
|
||||
[s2; Returns the position of the first element with value [%-*@3 x]
|
||||
|
|
@ -220,7 +225,7 @@ Unlinked elements are ignored.&]
|
|||
[s0;l288;a4;%- [*@5;1 Requires T to have deep copy constructor.]&]
|
||||
[s0;l288;a4;%- [*@5;1 Invalidates iterators to AIndex.]&]
|
||||
[s2;%- [*@5;1 Invalidates references to Index.]&]
|
||||
[s3;%- &]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Index`:`:Unlink`(int`):%- [@(0.0.255) void]_[* Unlink]([@(0.0.255) int]_[*@3 i])&]
|
||||
[s2; Unlinks the element at [%-*@3 i]. The unlinked item stays in AIndex
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
topic "";
|
||||
topic "Range";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,2#27521748481378242620020725143825:desc]
|
||||
|
|
@ -10,16 +10,91 @@ topic "";
|
|||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[{_}%EN-US
|
||||
[ {{10000@(113.42.0) [s0; [*@7;4 Title]]}}&]
|
||||
[ {{10000@(113.42.0) [s0; [*@7;4 Range]]}}&]
|
||||
[s1;O_; &]
|
||||
[s0; Range is a concept&]
|
||||
[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 I][3 >]&]
|
||||
[s1;:Upp`:`:SubRangeClass`:`:class: [@(0.0.255) class]_[* SubRangeClass]&]
|
||||
[s2; &]
|
||||
[s3; &]
|
||||
[s0;i448;a25;kKO9;@(0.0.255) &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Function List]]}}&]
|
||||
[s0;i448;a25;kKO9;:noref:@(0.0.255) &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Public Method List]]}}&]
|
||||
[s0; U`+`+ algorithms are designed to work on [*/ Ranges]. Range is
|
||||
a type that has (at minimum)&]
|
||||
[s0; &]
|
||||
[ {{10000F(128)G(128)@1 [s0; [* Constructor detail]]}}]]
|
||||
[s0;i150;O0; Standard begin() / end() methods.&]
|
||||
[s0;i150;O0; GetCount() that returns the number of elements in Range
|
||||
(can be implemented as end `- begin)&]
|
||||
[s0;i150;O0; operator`[`] (can be implemented as begin()`[i`])&]
|
||||
[s0; &]
|
||||
[s0; Standard Ranges usually also implement ToString and comparisons
|
||||
(if it is possible).&]
|
||||
[s0; &]
|
||||
[s0; Usually, Range is either U`+`+ container or just some part of
|
||||
it.&]
|
||||
[s0; &]
|
||||
[s0; U`+`+ provides these Range related typedefs and template functions:&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:ValueTypeOf`:`:typedef:%- [@(0.0.255) template <class ][*@4 Range][@(0.0.255) >
|
||||
using]_[* ValueTypeOf];&]
|
||||
[s2; Returns the type of elements of Range.&]
|
||||
[s3;%- &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:IteratorOf`:`:typedef:%- [@(0.0.255) template <class ][*@4 Range][@(0.0.255) >
|
||||
using]_[* IteratorOf];&]
|
||||
[s5;:Upp`:`:ConstIteratorOf`:`:typedef:%- [@(0.0.255) template <class
|
||||
][*@4 Range][@(0.0.255) > using]_[* ConstIteratorOf]`'&]
|
||||
[s2; Returns the type of Iterator / ConstIterator of range.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:SubRange`(I`,I`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 I]>_&]
|
||||
[s5;:Upp`:`:SubRange`(I`,I`):%- [_^Upp`:`:SubRangeClass^ SubRangeClass]<[*@4 I]>_[* SubRang
|
||||
e]([*@4 I]_[*@3 begin], [*@4 I]_[*@3 end])&]
|
||||
[s2; Makes a Range based on begin/end iterators.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:SubRange`(I`,int`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 I]>_&]
|
||||
[s5;:Upp`:`:SubRange`(I`,int`):%- [_^Upp`:`:SubRangeClass^ SubRangeClass]<[*@4 I]>_[* SubRa
|
||||
nge]([*@4 I]_[*@3 begin], [@(0.0.255) int]_[*@3 count])&]
|
||||
[s2; Makes a Range based on begin iterator and count.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:SubRange`(C`&`,int`,int`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 C]>
|
||||
_&]
|
||||
[s5;:Upp`:`:SubRange`(C`&`,int`,int`):%- [@(0.0.255) auto]_[* SubRange]([*@4 C][@(0.0.255) `&
|
||||
]_[*@3 c], [@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 count]);&]
|
||||
[s5;:Upp`:`:SubRange`(const C`&`,int`,int`):%- [@(0.0.255) template]_<[@(0.0.255) class]_
|
||||
[*@4 C]>_&]
|
||||
[s5;:Upp`:`:SubRange`(const C`&`,int`,int`):%- [@(0.0.255) auto]_[* SubRange]([@(0.0.255) c
|
||||
onst]_[*@4 C][@(0.0.255) `&]_[*@3 c], [@(0.0.255) int]_[*@3 pos], [@(0.0.255) int]_[*@3 count])
|
||||
;&]
|
||||
[s2; Makes a Range as subrange of some other Range (e.g. container).&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:SubRangeOf`:`:typedef:%- [@(0.0.255) template <class ][*@4 Range][@(0.0.255) >
|
||||
using]_[* SubRangeOf];&]
|
||||
[s2; Returns the type of SubRange of some Range.&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:ConstRange`(const T`&`,int`):%- [@(0.0.255) template]_<[@(0.0.255) class]_[*@4 T
|
||||
]>_&]
|
||||
[s5;:Upp`:`:ConstRange`(const T`&`,int`):%- [_^Upp`:`:ConstRangeClass^ ConstRangeClass]<
|
||||
[*@4 T]>_[* ConstRange]([@(0.0.255) const]_[*@4 T][@(0.0.255) `&]_[*@3 value],
|
||||
[@(0.0.255) int]_[*@3 count])&]
|
||||
[s2; Creates a Range of [%-*@3 count] elements equal to [%-*@3 value].&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:ViewRange`(BaseRange`&`,Upp`:`:Vector`<int`>`&`&`):%- [@(0.0.255) template]_
|
||||
<[@(0.0.255) class]_[*@4 BaseRange]>_&]
|
||||
[s5;:Upp`:`:ViewRange`(BaseRange`&`,Upp`:`:Vector`<int`>`&`&`):%- [_^Upp`:`:ViewRangeClass^ V
|
||||
iewRangeClass]<[*@4 BaseRange]>_[* ViewRange]([*@4 BaseRange][@(0.0.255) `&]_[*@3 r],
|
||||
[_^Upp`:`:Vector^ Vector]<[@(0.0.255) int]>`&`&_[*@3 ndx])&]
|
||||
[s2; Creates a view of [%-*@4 BaseRange ][%-*@3 r] based on mapping [%-*@3 ndx].
|
||||
Element at [%-*@3 ndx]`[0`] becomes a first element of a new Range,
|
||||
[%-*@3 ndx]`[1`] second etc..&]
|
||||
[s3; &]
|
||||
[s4;%- &]
|
||||
[s5;:Upp`:`:FilterRange`(BaseRange`&`,Predicate`):%- [@(0.0.255) template]_<[@(0.0.255) c
|
||||
lass]_[*@4 BaseRange], [@(0.0.255) class]_[*@4 Predicate]>_&]
|
||||
[s5;:Upp`:`:FilterRange`(BaseRange`&`,Predicate`):%- [_^Upp`:`:ViewRangeClass^ ViewRang
|
||||
eClass]<[*@4 BaseRange]>_[* FilterRange]([*@4 BaseRange][@(0.0.255) `&]_[*@3 r],
|
||||
[*@4 Predicate]_[*@3 p])&]
|
||||
[s2; Same as ViewRangeClass<BaseRange>([%-*@3 r], FindAll([%-*@3 r],
|
||||
[%-*@3 p])). Creates a view of elements of master Range that satisfy
|
||||
condition [%-*@3 p].&]
|
||||
[s3; &]
|
||||
[s0; ]]
|
||||
Loading…
Add table
Add a link
Reference in a new issue