userver-framework / userver

Production-ready C++ Asynchronous Framework with rich functionality
https://userver.tech
Apache License 2.0
2.41k stars 282 forks source link

Implement reverse iterators for the arrays in formats::yaml::Value #177

Open apolukhin opened 1 year ago

apolukhin commented 1 year ago

The reverse iterators for arrays in formats::yaml::Value would be handy https://github.com/userver-framework/userver/blob/develop/shared/include/userver/formats/yaml/value.hpp

Note that key in YAML are unordered, so there's no sence in making reverse iterators for keys.

For an example see reverse iterators in formats::json::Value https://github.com/userver-framework/userver/blob/develop/shared/include/userver/formats/json/value.hpp

oleggladyshev commented 1 year ago

@apolukhin, I've took a look at the issue and it turns out that userver/formats/yaml/ iterators are simply wrappers for iterators from the yaml-cpp library and the yaml-cpp iterators don't support reverse semantic now.
Probably, a good solution would be to implement reverse iterators in the yaml-cpp at first. Am I right or you supposed a different approach here?

apolukhin commented 6 months ago

You are right. It seems that the fix should be done in yaml-cpp first