## MMAP.H

Wraps and simplifies use of mmap(2) and munmap(2) functions.

Example of how to save an object of type T in mmaped file:

```#define path "t.mmap"
T  a;
mmap_write(path,a);             // saves object a
T& b  = mmap_read<T>(path);     // restore object a in object b```

Same, but now we save an array: T a[n]; mmap_write(path,a);

```size_t n;                       // array size
T  *b  = mmap_read<T>(path,n);  // restore it, size in n
for (size_t i=0;  i<n;  ++i)
cout << b[i];```

## ARRAY.H

Static sized container, similar to tr1::array, but faster and more capable. See array docs

## CHECK.H

Very basic unit testing.

Example use:

```#include <lvv/check.h>
using namespace lvv;

int main() {
// Check basic math
CHECK(1+2       == 3);          // eval expression;
CHECK(2*2       == 4);          // prints pass/fail, line-number and expression
CHECK(1/2       == 0.5);
CHECK(4-2       == 2);

CHECK_EXIT;                     // prints failure if any test fails, success otherwise
}```

Output:

```    pass     6          check:          1+2 == 3
pass     7          check:          2*2 == 4
>>> FAIL <<< 8          check:          1/2 == 0.5

!!!!!!!!!  SOME FAILED  !!!!!!!!```

## SIMPLE.H

Used for something like Google CodeJam. Includes most common STL headers; can print any STL containers simply by cout << C; simplified line-oriented input (for CodeJam).

Example use:

```#include<lvv/simple.h>

int main()  {

vector<int>     V = {0, 1, 2, 3, 4, 5, 6};
cout << V << endl;

list<int>       L = {0, 1, 2, 3, 4, 5, 6};
cout << L << endl;

set<int>        S = {6,3,4,1,2,0,5};
cout << S << endl;

map<string,int> M = { {"A",1}, {"B",2}, {"C",3} };
cout <<  M << endl;

cout <<  make_pair("abcd", 123) << endl;
}```

Output:

```0, 1, 2, 3, 4, 5, 6   size:7
0, 1, 2, 3, 4, 5, 6   size:7
0, 1, 2, 3, 4, 5, 6   size:7
<A,1>, <B,2>, <C,3>   size:3
<abcd,123>```

## TIMER.H

Various timer funcion: interval/total for cpu/wall/tick time. Extensivly used for benchmarking.

Example use:

```#include <lvv/timer.h>
using lvv::Timer;

int main() {
Timer   tm;     // CTOR inits total counters and interval counters
// any timer read, resets conresponding interval counter
// reset() - resets all intervals timers

cout << "\n usleep(30000) ... \n";              usleep(useconds_t(30000));

cout << "\n interval_ticks():   " <<            tm.interval_ticks();
cout << "\n interval_wall():    " <<            tm.interval_wall();
cout << "\n interval_cpu():     " <<            tm.interval_cpu();

cout << "\n\n usleep(20000) ... \n";            usleep(useconds_t(20000));

cout << "\n total_ticks():      " <<            tm.total_ticks();
cout << "\n total_wall():       " <<            tm.total_wall();
cout << "\n total_cpu():        " <<            tm.total_cpu();

cout << "\n\n Raw CPU tick reader:   "  <<      read_tick()     << endl;
}```

## Other

Header Sample Use Description

float.h

u-float.cc

floating point traits and bit-twiddling

sse.h

u-array.cc

sse

## How to submit patch

You can just email patch to leonid@volnitsky.com. All feedback is much appreciated.

If you are on Github it is even easier. See github patch-submit HOWTOs: ( 1, 2, 3 ) .

There is no hard set style rules.