Skip to content

to_json/from_json calls for typedefd types #4444

Answered by kimci86
TheMiles asked this question in Q&A
Discussion options

You must be logged in to vote

Your problem is that tools::Hash is std::array<uint8_t, 6>. It is an alias. So the functions you wrote in tools namespace do not matter. This type actually is in namespace std.
So to achieve what you want, you could either fully specialize adl_serializer for that type (see documentation), or use a distinct type that actually is in tools namespace. A simple and lazy trick would be inheritance: struct Hash : std::array<uint8_t, 6> {};.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by TheMiles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants