Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Json::Object iterator fields to "key" and "value" #1232

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ras0219-msft
Copy link
Contributor

Convert CeMetadata manipulation to adhere to existing JsonDeserializer requirements.

(This is in preparation for tracking original source locations through Json deserialization)

@@ -200,12 +200,24 @@ namespace vcpkg::Json

struct Object
{
struct value_type
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to call this ObjectProperty or similar rather than a nested struct.

Comment on lines +205 to +206
value_type(std::string sv, Value&& v) : key(std::move(sv)), value(std::move(v)) { }
value_type(std::string sv, const Value& v) : key(std::move(sv)), value(v) { }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to avoid double string moves here. How about something like:

Suggested change
value_type(std::string sv, Value&& v) : key(std::move(sv)), value(std::move(v)) { }
value_type(std::string sv, const Value& v) : key(std::move(sv)), value(v) { }
template<class StringLike, class ValueLike>
value_type(StringLike&& s, ValueLike&& v) : key(std::forward<StringLike>(sv)), value(std::forward<ValueLike>(v)) { }

Alternately, can this thing be an aggregate?

ras0219-msft and others added 2 commits April 29, 2024 21:33
Convert CeMetadata manipulation to adhere to existing JsonDeserializer requirements.

(This is in preparation for tracking original source locations through Json deserialization)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants