123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include <boost/redis/response.hpp>
- #include <boost/redis/error.hpp>
- #include <boost/assert.hpp>
- namespace boost::redis
- {
- void consume_one(generic_response& r, system::error_code& ec)
- {
- if (r.has_error())
- return;
- if (std::empty(r.value()))
- return;
- auto const depth = r.value().front().depth;
-
-
-
- if (depth != 0) {
- ec = error::incompatible_node_depth;
- return;
- }
- auto f = [depth](auto const& e)
- { return e.depth == depth; };
- auto match = std::find_if(std::next(std::cbegin(r.value())), std::cend(r.value()), f);
- r.value().erase(std::cbegin(r.value()), match);
- }
- void consume_one(generic_response& r)
- {
- system::error_code ec;
- consume_one(r, ec);
- if (ec)
- throw system::system_error(ec);
- }
- }
|