Skip to content

Private member initialization with overload of from_json? #4413

Answered by gregmarr
stlamoureux1 asked this question in Q&A
Discussion options

You must be logged in to vote

In order to access private data directly, you must declare the functions as friends in the same way as the INTRUSIVE macros.

    template<typename BasicJson>
    friend void to_json(BasicJson& j, const Type& t)
    {
    }
    template<typename BasicJson>
    friend void from_json(const BasicJson& j, Type& t)
    {
    }

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stlamoureux1
Comment options

@gregmarr
Comment options

@stlamoureux1
Comment options

Answer selected by stlamoureux1
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