mirror of
https://gitlab.com/fbb-git/cppannotations
synced 2024-11-16 07:48:44 +01:00
cosmetics
This commit is contained in:
parent
32f867c44e
commit
540ebfe056
4 changed files with 14 additions and 4 deletions
|
@ -20,7 +20,7 @@
|
|||
|
||||
// options to be used by the compilers
|
||||
#define COPT "-Wall -O2 -fdiagnostics-color=never -g"
|
||||
#define CPPOPT "--std=c++14 -Wall -O2 -fdiagnostics-color=never -g"
|
||||
#define CPPOPT "-Wall -O2 -fdiagnostics-color=never -g"
|
||||
|
||||
// extra library for the C++ programs
|
||||
#define BOBCAT "bobcat"
|
||||
|
|
|
@ -25,7 +25,7 @@ int main()
|
|||
vector<int> values = {1, 2, 3, 4, 5};
|
||||
vector<string> text = {"a", "b", "c", "d", "e"};
|
||||
|
||||
cout << accumulate(values, lambda) << '\n' <<
|
||||
cout << accumulate(values, lambda) << '\n' <<
|
||||
accumulate(text, lambda) << '\n';
|
||||
}
|
||||
//=
|
||||
|
|
|
@ -81,3 +81,14 @@ a generic class template, which can be used as shown:
|
|||
This works fine, but if you define tt(lambda) this way then you should be
|
||||
prepared for complex error messages if the types of the derefenced iterators
|
||||
and lambda's (silently assumed) tt(str) type don't match.
|
||||
|
||||
Here is a little program illustrating how generic lambda expressions can be
|
||||
used in other generic lambda expressions: class templates could also have been
|
||||
used. In lines 1 through 9 a generic lambda expression tt(accumulate) is
|
||||
defined, defining a second paramater which is used as a function: its argument
|
||||
therefore should be usable as a function. A functor definitely is, an the
|
||||
second generic lambda expression tt(lambda), defined in lines 11 through 14
|
||||
provides it. In line 21 tt(accumulate) and tt(lambda) are instantiated so that
|
||||
they operate on (a vector of) tt(ints), in line 22 they are instantiated for
|
||||
processing (a vector of) tt(strings):
|
||||
verbinsert(-ns4 //code examples/genlambda2.cc)
|
||||
|
|
|
@ -130,7 +130,7 @@ The annotations() distinguishes the following categories
|
|||
link(upper_bound)(UPPERBOUND);
|
||||
)
|
||||
it() Shufflers: performing reordering operations (i(sorting),
|
||||
i(merging), i(permuting), i(shuffling), i(swapping)):
|
||||
i(merging), i(permuting), i(swapping)):
|
||||
quote(
|
||||
link(inplace_merge)(INMERGE);
|
||||
link(iter_swap)(ITERSWAP);
|
||||
|
@ -141,7 +141,6 @@ The annotations() distinguishes the following categories
|
|||
link(partial_sort_copy)(PARTSORTCP);
|
||||
link(partition)(PARTIT);
|
||||
link(prev_permutation)(PREVPERM);
|
||||
link(random_shuffle)(SHUFFLE);
|
||||
link(remove)(REMOVE);
|
||||
link(remove_copy)(REMOVECP);
|
||||
link(remove_copy_if)(REMOVECPIF);
|
||||
|
|
Loading…
Reference in a new issue