hjiang/jsonxx — pull request #22 by Rapptz (2013-11-03 23:00:54+00:00)
Title: Add default values

This patch adds the ability to get default values for `Object` and `Array` without having to use `has` beforehand. It uses an identity meta-function so you still have to provide the template parameter for a consistent API.

I added test cases (they all pass) and updated the README for example usage.

Here is an example usage for brevity:

```cpp
#include

const std::string file("{ \"type\": \"basic\", \"list\": [\"string\", 10] }");

int main() {
using namespace jsonxx;
Object o;
assert(o.parse(file));
assert(!o.has("file"));
assert(o.get("file", "test.txt") == "test.txt");
assert(!o.get("list").has(2));
assert(o.get("list").get(2, 10) == 10);
}
```