You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe what you want to achieve.
I've deifned functions to_json for user defined classes, i.e.
class foo
{
friend inline void to_json(json& j, const foo& obj) {...}.
}
These code work well.
But I wonder if we can define the function like 'json& to_json(void) {...}' as a memeber function in the class foo?
The purpose for this function is that I want to use virtual function of basic class, and all derived classes can automatic define their reload funtion such as 'cout << to_json() << endl';
If can, how to define this function?
Describe what you tried.
Describe which system (OS, compiler) you are using.
Ubuntu 18.04 LTS, g++ 7.3;
Describe which version of the library you are using (release version, develop branch).
the master version.
The text was updated successfully, but these errors were encountered:
Describe what you want to achieve.
I've deifned functions to_json for user defined classes, i.e.
class foo
{
friend inline void to_json(json& j, const foo& obj) {...}.
}
These code work well.
But I wonder if we can define the function like 'json& to_json(void) {...}' as a memeber function in the class foo?
The purpose for this function is that I want to use virtual function of basic class, and all derived classes can automatic define their reload funtion such as 'cout << to_json() << endl';
If can, how to define this function?
Describe what you tried.
Describe which system (OS, compiler) you are using.
Ubuntu 18.04 LTS, g++ 7.3;
Describe which version of the library you are using (release version, develop branch).
the master version.
The text was updated successfully, but these errors were encountered: