kazuho/picojson — pull request #52 by kazuho (2014-10-22 03:31:11+00:00)
Title: Make value types replacable (by providing type traits)

Until now, picojson has fixed the types used to represent various types of JSON (e.g. number, string, boolean, ...). But there has been a constant request to _replace_ how the numbers are represented (which has been handled to some extent by adding the `PICOJSON_USE_INT64` flag).

The ideal way to answer such requests is to templatize the `value` type so that the types used for storing the JSON values via type traits (using `#ifdef`s to switch between the types is not an answer, since it might cause compile or link-time problems when more than one module uses picojson with different set of `#define`s).

This PR does that. It implements a type trait (only for numbers at the moment), so that users can define their own set of traits and use the templatized value type (`value_t`).

I am going to merge this branch to master if I anybody actually starts using the feature.