mirror of
https://github.com/boostorg/describe.git
synced 2026-01-19 04:12:07 +00:00
Update json_rpc example to work on both versions of Boost.JSON
This commit is contained in:
@@ -34,7 +34,7 @@ template<class C1, class C2, class R, class... A>
|
||||
|
||||
template<class C>
|
||||
boost::json::value
|
||||
call( C & c, boost::string_view method, boost::json::value const & args )
|
||||
call( C & c, boost::string_view method, boost::json::array const & args )
|
||||
{
|
||||
using Fd = boost::describe::describe_members<C,
|
||||
boost::describe::mod_public | boost::describe::mod_function>;
|
||||
@@ -46,7 +46,7 @@ template<class C>
|
||||
|
||||
if( !found && method == D.name)
|
||||
{
|
||||
result = call_impl( c, D.pointer, args.as_array() );
|
||||
result = call_impl( c, D.pointer, args );
|
||||
found = true;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,6 @@ BOOST_DESCRIBE_STRUCT(Object, (), (greet, add))
|
||||
int main()
|
||||
{
|
||||
Object obj;
|
||||
std::cout << call( obj, "greet", {{ "world" }} ) << std::endl;
|
||||
std::cout << call( obj, "add", {{ 1, 2 }} ) << std::endl;
|
||||
std::cout << call( obj, "greet", { "world" } ) << std::endl;
|
||||
std::cout << call( obj, "add", { 1, 2 } ) << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user