From 4ea3752e5dbb560d44ff67dbbd41b30d3b2e482c Mon Sep 17 00:00:00 2001 From: klugier Date: Sun, 31 Jul 2016 19:28:53 +0000 Subject: [PATCH] .doc .core Core tutorials now use 1.5 line height git-svn-id: svn://ultimatepp.org/upp/trunk@10125 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/srcdoc.tpp/CoreTutorial$en-us.tpp | 2 +- uppsrc/Core/srcdoc.tpp/Tutorial$en-us.tpp | 32 +++++++++++-------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/uppsrc/Core/srcdoc.tpp/CoreTutorial$en-us.tpp b/uppsrc/Core/srcdoc.tpp/CoreTutorial$en-us.tpp index 0f4f3ff1e..ee523e270 100644 --- a/uppsrc/Core/srcdoc.tpp/CoreTutorial$en-us.tpp +++ b/uppsrc/Core/srcdoc.tpp/CoreTutorial$en-us.tpp @@ -4,7 +4,7 @@ topic "U++ Core value types tutorial"; [a83;*R6 $$2,5#31310162474203024125188417583966:caption] [b83;*4 $$3,5#07864147445237544204411237157677:title] [i288;O9;C2 $$4,6#40027414424643823182269349404212:item] -[b42;a42;2 $$5,5#45413000475342174754091244180557:text] +[b42;a42;ph2 $$5,5#45413000475342174754091244180557:text] [l288;b17;a17;2 $$6,6#27521748481378242620020725143825:desc] [l321;t246;C@5;1 $$7,7#20902679421464641399138805415013:code] [b2503;2 $$8,0#65142375456100023862071332075487:separator] diff --git a/uppsrc/Core/srcdoc.tpp/Tutorial$en-us.tpp b/uppsrc/Core/srcdoc.tpp/Tutorial$en-us.tpp index ded319a81..daed059ea 100644 --- a/uppsrc/Core/srcdoc.tpp/Tutorial$en-us.tpp +++ b/uppsrc/Core/srcdoc.tpp/Tutorial$en-us.tpp @@ -4,7 +4,7 @@ topic "NTL Tutorial"; [a83;*R6 $$2,5#31310162474203024125188417583966:caption] [H4;b83;*4 $$3,5#07864147445237544204411237157677:title] [i288;O9;C2 $$4,6#40027414424643823182269349404212:item] -[b42;a42;2 $$5,5#45413000475342174754091244180557:text] +[b42;a42;ph2 $$5,5#45413000475342174754091244180557:text] [l288;b17;a17;2 $$6,6#27521748481378242620020725143825:desc] [l321;C@5;1 $$7,7#20902679421464641399138805415013:code] [b2503;2 $$8,0#65142375456100023862071332075487:separator] @@ -73,7 +73,7 @@ unknown maximal value&] [s7; -|[* Sort](v);&] [s17; v `= `{ 958, 983, 989, 992, 998, 998, 1007, 1012, 1013, 1050 `}&] -[s0; &] +[s5; &] [s3; 3. Transfer issues&] [s5; Often you need to pass content of one container to another of the same type. NTL containers always support [^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ p @@ -96,7 +96,7 @@ in that case, pick transfer is the only option anyway.&] support deep copy operation), you can use [^topic`:`/`/Core`/srcdoc`/pick`_`$en`-us^ c lone]&] [s7; -|v [* `=] clone(v1);&] -[s7; &] +[s5; &] [s3; 4. Client types&] [s5; So far we were using int as type of elements. In order to store client defined types into the Vector (and the Vector [^topic`:`/`/Core`/src`/Overview`$en`-us^ f @@ -148,7 +148,7 @@ might be generated by some function &] [s7; -|-|dist.[* AddPick](CreateDist(n));&] [s5; alternatively, you can use default`-constructed variant too&] [s7; -|-|dist.Add() `= CreateDist(); // alternative&] -[s7; &] +[s5; &] [s3; 5. Array flavor&] [s5; If elements do not satisfy requirements for Vector flavor, they can still be stored in Array flavor. Another reason for using @@ -163,7 +163,7 @@ reasons):&] [s7; -|-|for(int q `= 0; q < i; q`+`+)&] [s7; -|-|-|l.push`_back(q);&] [s7; -|`}&] -[s7; &] +[s5; &] [s3; 6. Polymorphic Array&] [s5; Array can even be used for storing polymorphic elements &] [s7; struct Number `{&] @@ -212,6 +212,7 @@ directly apply Sort on such Array&] [s7; &] [s7; -|Sort(num);&] [s17; num `= `{ 3, 15.5 `}&] +[s5; &] [s3; 7. Bidirectional containers&] [s5; Vector and Array containers allow fast adding and removing elements at the end of sequence. Sometimes, same is needed at begin of @@ -233,6 +234,7 @@ case, BiVector and BiArray should be used&] [s7; -|num.CreateHead().n `= 2.23;&] [s7; -|num.CreateTail().n `= 2;&] [s17; num `= `{ 2.23, 3, 15.5, 2 `}&] +[s5; &] [s3; 8. Index&] [s5; Index is a container very similar to the plain Vector (it is random access array of elements with fast addition at the end) @@ -321,6 +323,7 @@ source Index)&] [s7; -|Vector d `= ndx.[* PickKeys]();&] [s7; -|Sort(d);&] [s17; d `= `{ delta, delta, foo, insert, one, three `}&] +[s5; &] [s3; 9. Index and client types&] [s5; In order to store elements to Index, they must be moveable (you can use [* ArrayIndex] for types that are not) and they must have @@ -351,6 +354,7 @@ surname); `}&] [s7; -| &] [s7; -|DUMP(p.Find(Person(`"Paul`", `"Carpenter`")));&] [s17; p.Find(Person(`"Paul`", `"Carpenter`")) `= 1&] +[s5; &] [s3; 10. VectorMap, ArrayMap&] [s5; VectorMap is nothing more than a simple composition of Index and Vector. You can use [* Add] methods to put elements into the @@ -402,7 +406,7 @@ for Find operations&] [s7; -|DUMP(m.Get(`"33`", Person(`"unknown`", `"person`")));&] [s17; m.Get(`"33`", Person(`"unknown`", `"person`")) `= Carl Engles&] [s5; If there are more elements with the same key in VectorMap, you -can iterate them using [* FindNext] method&] +can iterate them using [* FindNext] method:&] [s7; -|m.Add(`"33`", Person(`"Peter`", `"Pan`"));&] [s7; &] [s16; m.GetKeys() `= `{ 1, 33, 3, 33 `}&] @@ -418,7 +422,7 @@ Peter Pan `}&] [s16; Carl Engles&] [s16; Peter Pan&] [s7; &] -[s5; You can reuse unlinked positions using [* Put] method&] +[s5; You can reuse unlinked positions using [* Put] method:&] [s7; -|m.[* UnlinkKey](`"33`");&] [s7; -|m.[* Put](`"22`", Person(`"Ali`", `"Baba`"));&] [s7; -|m.Put(`"44`", Person(`"Ivan`", `"Wilks`"));&] @@ -469,7 +473,7 @@ instead&] [s7; &] [s16; am.Get(`"A`") `= 11&] [s16; am.Find(`"B`") `= 1&] -[s16; &] +[s5; &] [s3; 11. One&] [s5; One is a container that can store none or one element of T or derived from T. It functionally quite similiar to std`::unique`_ptr, @@ -543,7 +547,7 @@ with reference to One parameter, e.g.:&] [s7; `{&] [s7; -|(`*factories.Get(what))(t);&] [s7; `}&] -[s7; &] +[s5; &] [s3; 12. Any&] [s5; Any is a container that can contain none or one element of [*/ any] type, the only requirement is that the type has default constructor. @@ -572,7 +576,7 @@ but if Any contains FileIn, Is() returns false).&] [s7; -|Do(x);&] [s7; -|x.[* Clear]();&] [s7; -|Do(x);&] -[s7; &] +[s5; &] [s3; 13. InVector, InArray&] [s5; InVector and InArray are vector types quite similar to Vector/Array, but they trade the speed of operator`[`] with the ability to @@ -593,7 +597,7 @@ it is possible to provide InVector specific optimization that basically matches the performace of Find`*Bound on sample Vector.&] [s7; &] [s7; -|DUMP(v.[* FindLowerBound](55));&] -[s7; &] +[s5; &] [s3; 14. SortedIndex, SortedVectorMap, SortedArrayMap&] [s5; SortedIndex is similar to regular Index, but keeps its elements in sorted order (sorting predicate is a template parameter, defaults @@ -622,7 +626,7 @@ equivalents to VectorMap/ArrayMap `- maps that keep keys sorted:&] [s7; -|&] [s7; -|DUMPM(m);&] [s7; -|DUMP(m.[* Get](`"zulu`"));&] -[s7; &] +[s5; &] [s3; 15. Tuples&] [s5; U`+`+ has template classes Tuple2, Tuple3 and Tuple4 for combining 2`-4 values with different types. These are quite similiar to @@ -679,7 +683,7 @@ POD arrays to be intialized with classic C style:&] [s5; &] [s5; Simple FindTuple template function is provided to search for tuple based on the first value:&] -[s7; &] +[s5; &] [s3; 15. Sorting&] [s5; IndexSort is sort variant that is able to sort two random access container (like Vector or Array) of the same size, based on values @@ -747,4 +751,4 @@ penalty):&] [s7; -|[* StableSort](t, FieldRelation(`&Point`::x, StdLess()));&] [s7; &] [s16; t `= `[`[1, 0`], `[7, 1`], `[7, 2`], `[7, 3`], `[10, 10`]`]&] -[s7; ]] \ No newline at end of file +[s5; ]] \ No newline at end of file