-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
The library cannot work properly with custom allocator based containers #766
Description
Motivation:
In order to be able to pass std::string std::vector std::list containers between different binaries it was required to define a custom allocator because the project I am involved in uses binaries with statically linked CRT.
Issue:
Once I defined own allocator and std containers that using it I faced a problem - if I need to put data from std::string to my customized std::basic_string I always need to copy data. Suppose tmp::string is my customized string and std::string is usual string. So in order to put data from 2nd to 1st I need to use c_str() each time. The best solution is to instantiate the nlohmann::basic_json with my customized containers. But inside the library its utility classes do not take into account the string_t alias and its string_t::value_type as well thus this leads to errors. I tried to push required types to each class inside the library that use std::string, char, std::vector etc... I did a lots of work but suddenly faced with difficulties that I just cannot understand. So I'm asking a society to help me to solve the issue and improve the json library as a result - to make it truly(or almost truly) template.
Here is the test project that does not compile because static assert fired up with a statement that the "to_json" function with my custom types does not exist. The thing that I am wondering of is that the "to_json" function based on custom types exists(as it follows from the build log) and this confuses me a lot.
The fork of the JSON parser attached as sub module. And this is a MS VS 2017 project.
Thanks a lot.
PS: build.log.txt