Skip to content

Add more flexibility to basic_json's ObjectType (and ArrayType) #2013

Description

@1410rlH

Custom ObjectTypes are in hard limits:

basic_json<> // ok
basic_json<std::map> // ok (the same)
template<class Key, class Value, class Comp, class Alloc> 
my_stl_like_map {};
basic_json<my_stl_like_map> // ok (the same)

basic_json<std::unordered_map> // Won't compile (hash != comparator)

template<class Key, class Value> 
MyMap {};
basic_json<MyMap> // Won't compile (too few templates)

I suggest changing the following line with some metaprogramming or using only Key and Value:

    using object_t = ObjectType<StringType,
          basic_json,
/* Maybe leave those below as default (won't allow custom allocators :( ) */
          object_comparator_t,
          AllocatorType<std::pair<const StringType,
          basic_json>>>;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions