boostorg / boostorg/json

Show intrusive conversions for `ip_address` in documentation

Open
#1,123 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
479
Forks
110
Avg merge
10d 3h
Merged PRs (30d)
5

Description

Currently, the conversions for `ip_address` in the documentation are written to only use its public interface; this presumably demonstrates how conversions can be implemented non-intrusively without modifying the original (third-party) type.

However, in this case the same serialized result can be achieved much more simply if the `tag_invoke` overloads are made inline friends, because they can just de/serialize the `octets_` member directly.

(This will result in significant lines of code savings for the non-throwing `value_to`.)

This will be a good opportunity to also recommend the use of inline friends over functions in the enclosing namespace, because they don't contribute to the overload set unless needed, which speeds up overload resolution and shortens compile times. (This is especially important for `tag_invoke`, because the function name is the same so the namespace can quickly fill up with overloads.)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.