boostorg / json

A C++11 library for parsing and serializing JSON to and from a DOM container in memory.
https://boost.org/libs/json
Boost Software License 1.0
432 stars 94 forks source link

Can the value_from function add iterator parameters, such as value_from (Iterator begin, Iterator end) #1000

Open wcy168 opened 5 months ago

wcy168 commented 5 months ago

PLEASE DON'T FORGET TO "STAR" THIS REPOSITORY :)

When reporting a bug please include the following:

Version of Boost

You can find the version number in the file <boost/version.hpp>

Steps necessary to reproduce the problem

A small compiling program is the best. If your code is public, you can provide a link to the repository.

All relevant compiler information

If you are unable to compile please include the type and version of compiler you are using as well as all compiler output including the error message, file, and line numbers involved.

The more information you provide the sooner your issue can get resolved!

grisumbras commented 5 months ago

You didn't explain the desired semantics, so I assume it's supposed to produces a json::value that stores an array. So, my questions are these. Why converting a sequence object doesn't work for you? Where do you get the iterators?

wcy168 commented 5 months ago

You don't have the required semantics to explain, so I think it should produce a store. Why doesn't converting sequence objects work for you? Where do you get iterators?json::value``array

Due to the large amount of data in my sequential container, I can only send a part of it at a time. Therefore, I need to serialize just this portion, so I expect to transmit the iterator range.

grisumbras commented 5 months ago

But can't you wrap two iterators into a range-like class? This one should work: https://www.boost.org/doc/libs/1_85_0/libs/range/doc/html/range/reference/utilities/iterator_range.html But if you have access to C++20, this should also work: https://en.cppreference.com/w/cpp/ranges/subrange

wcy168 commented 5 months ago

But can't you wrap two iterators into a range-like class? This one should work: https://www.boost.org/doc/libs/1_85_0/libs/range/doc/html/range/reference/utilities/iterator_range.html But if you have access to C++20, this should also work: https://en.cppreference.com/w/cpp/ranges/subrange

good idea,thank you

grisumbras commented 5 months ago

So, did it work for you? Can I close this?