-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
string_type in binary_reader #941
Description
Feature Request
-
Describe the feature in as much detail as possible.
Currently binary_reader requires using std::string, which is cumbersome when trying to work with custom non-standard string classes. In my specific usecase, embedded system and cbor parsing. -
Include sample usage where appropriate.
The rest of the header currently compiles with a custom string type stand-in with a very minimal standard interface part:
struct awfully_poor_str {
static const size_t npos = static_cast<size_t>(-1);
using value_type = char;
void push_back(char);
awfully_poor_str();
awfully_poor_str(const char *);
};
Changing binary_reader to
using string_t = typename BasicJsonType::string_t;
makes it compile as well. Or is there a definite reason why it should use std::string there ?
BTW, on a cortex-m0 compile with custom vector and string types, exceptions/rtti off, and std::streams stubbed out i get about 3kB for the library code size right now. Intel's C tinycbor is about 2.5kB, and a smaller custom c++ cbor-only limited-features parser is <1kB