tanakh/cmdline — pull request #3 by nanoant (2012-11-26 19:56:02+00:00)
Title: Serialization & deserialization with os << & is >>

#### Here goes some useful patch ;)

Options marked for serialization (new `add()` parameter, on by default for
options with value, off for others) are now serialized with `ostream << cl`
operator and deserialized with `istream >> cl`.

Some live deserialization example:
```c++
// load config files
for (auto fn = cl.rest().begin(); fn != cl.rest().end(); ++fn) {
std::ifstream in(*fn+".cfg");
if (!in.is_open()) continue;
in >> cl;
break; // only one config file allowed!
}
```

Serialization example:
```c++
if (cl.exist("output")) {
auto fn = cl.get("output");
obstream out(fn, std::ios::binary | std::ios::trunc);
out << data;

std::ofstream os(fn+".cfg", std::ios::trunc);
os << cl;
}
```