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@10559 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
844599b61c
commit
774d14c6a3
3 changed files with 24 additions and 0 deletions
|
|
@ -46,6 +46,7 @@ file
|
|||
test.txt,
|
||||
CoWork.cpp,
|
||||
CoPartition.cpp,
|
||||
Parallel.cpp,
|
||||
tutorial2.cpp,
|
||||
help.qtf;
|
||||
|
||||
|
|
|
|||
22
tutorial/CoreTutorial/Parallel.cpp
Normal file
22
tutorial/CoreTutorial/Parallel.cpp
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "Tutorial.h"
|
||||
|
||||
void CoAlgoTutorial()
|
||||
{
|
||||
/// .Parallel algorithms
|
||||
|
||||
/// U++ provides a parallel version of algorithms where it makes sense. The naming scheme
|
||||
/// is 'Co' prefix before the name of algorithm designates the parallel version.
|
||||
|
||||
/// So the parallel version of e.g. `FindIndex` is `CoFindIndex`, for 'Sort' it is 'CoSort':
|
||||
|
||||
Vector<String> x{ "zero", "one", "two", "three", "four", "five" };
|
||||
|
||||
DUMP(FindIndex(x, "two"));
|
||||
DUMP(CoFindIndex(x, "two"));
|
||||
|
||||
CoSort(x);
|
||||
DUMP(x);
|
||||
|
||||
/// Caution should be exercised when using these algorithms - for small datasets, they are
|
||||
/// almost certainly slower than single-threaded versions.
|
||||
}
|
||||
|
|
@ -45,6 +45,7 @@ GUI_APP_MAIN
|
|||
DO(ConditionVariableTutorial);
|
||||
DO(CoWorkTutorial);
|
||||
DO(CoPartitionTutorial);
|
||||
DO(CoAlgoTutorial);
|
||||
|
||||
MakeTutorial();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue