mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@6427 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
a435032576
commit
3dff2b7d1d
3 changed files with 53 additions and 0 deletions
38
reference/BasicAlgo/BasicAlgo.cpp
Normal file
38
reference/BasicAlgo/BasicAlgo.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#include <Core/Core.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
CONSOLE_APP_MAIN{
|
||||
StdLogSetup(LOG_FILE|LOG_COUT);
|
||||
|
||||
Vector<int> data, empty;
|
||||
data << 10 << 5 << 11 << 9 << 2;
|
||||
|
||||
DUMP(Sum(data));
|
||||
|
||||
DUMP(FindMin(data, 0, data.GetCount() - 1));
|
||||
DUMP(FindMin(data));
|
||||
DUMP(Min(data));
|
||||
// DUMP(Min(empty)); // This is undefined (fails in ASSERT)
|
||||
DUMP(Min(empty, -99999));
|
||||
|
||||
DUMP(Sum(data));
|
||||
DUMP(FindMax(data, 3, 2));
|
||||
DUMP(FindMax(data));
|
||||
DUMP(Max(data));
|
||||
// DUMP(Max(empty)); // This is undefined (fails in ASSERT)
|
||||
DUMP(Max(empty, 99999));
|
||||
|
||||
Vector<String> s = Split("one;two;three", ';');
|
||||
DUMP(Sum(s, ""));
|
||||
|
||||
DUMP(sgn(10));
|
||||
DUMP(sgn(0));
|
||||
DUMP(sgn(-7));
|
||||
|
||||
DUMP(findarg(3, 1, 7, 6, 3, 2));
|
||||
DUMP(findarg(5, 1, 7, 6));
|
||||
|
||||
DUMP(decode(2, 1, "one", 2, "two", 3, "three", "?"));
|
||||
DUMP(decode(5, 1, "one", 2, "two", 3, "three", "?"));
|
||||
}
|
||||
11
reference/BasicAlgo/BasicAlgo.upp
Normal file
11
reference/BasicAlgo/BasicAlgo.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Basic function templates (min/max/sum/findarg/decode)\377";
|
||||
|
||||
uses
|
||||
Core;
|
||||
|
||||
file
|
||||
BasicAlgo.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "SSE2";
|
||||
|
||||
4
reference/BasicAlgo/init
Normal file
4
reference/BasicAlgo/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _BasicAlgo_icpp_init_stub
|
||||
#define _BasicAlgo_icpp_init_stub
|
||||
#include "Core/init"
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue