mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
.tutorial
git-svn-id: svn://ultimatepp.org/upp/trunk@11769 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
9544433b9a
commit
d9eeba5af1
1 changed files with 9 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ void Vector2()
|
|||
|
||||
DUMP(v);
|
||||
|
||||
/// At method returns element at specified position ensuring that such a position exists.
|
||||
/// `At` method returns element at specified position ensuring that such a position exists.
|
||||
/// If there is not enough elements in `Vector`, required number of elements is added. If
|
||||
/// second parameter of `At` is present, newly added elements are initialized to this value.
|
||||
|
||||
|
|
@ -35,6 +35,14 @@ void Vector2()
|
|||
v.At(Random(10), 0)++;
|
||||
|
||||
DUMP(v);
|
||||
|
||||
/// Referencing invalid index is undefined operation. Sometimes however it is useful to
|
||||
/// return the element value if index is valid and some default value if it is not. This
|
||||
/// can be achieved with two parameter Get method:
|
||||
|
||||
DUMP(v.Get(4, 0));
|
||||
DUMP(v.Get(-10, 0));
|
||||
DUMP(v.Get(13, -1));
|
||||
|
||||
/// You can apply algorithms on containers, e.g. Sort
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue