Skip to content

Commit

Permalink
Update JSON examples for JSON 1.81+
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Sep 9, 2024
1 parent 777bdec commit 18e7c01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions example/from_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
#include <boost/describe.hpp>
#include <boost/mp11.hpp>
#include <boost/json.hpp>
#include <boost/version.hpp>
#include <type_traits>

namespace app
{

#if BOOST_VERSION < 108100

template<class T> void extract( boost::json::object const & obj, char const * name, T & value )
{
value = boost::json::value_to<T>( obj.at( name ) );
Expand All @@ -36,6 +39,8 @@ template<class T,
return t;
}

#endif

struct A
{
int x;
Expand Down
5 changes: 5 additions & 0 deletions example/to_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
#include <boost/describe.hpp>
#include <boost/mp11.hpp>
#include <boost/json.hpp>
#include <boost/version.hpp>
#include <type_traits>
#include <vector>
#include <map>

namespace app
{

#if BOOST_VERSION < 108100

template<class T,
class D1 = boost::describe::describe_members<T,
boost::describe::mod_public | boost::describe::mod_protected>,
Expand All @@ -29,6 +32,8 @@ template<class T,
});
}

#endif

struct A
{
int x;
Expand Down

0 comments on commit 18e7c01

Please sign in to comment.