Skip to content

Commit c89e4dd

Browse files
committed
Update json_rpc example to work on both versions of Boost.JSON
1 parent 3047e5a commit c89e4dd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

example/json_rpc.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ template<class C1, class C2, class R, class... A>
3434

3535
template<class C>
3636
boost::json::value
37-
call( C & c, boost::string_view method, boost::json::value const & args )
37+
call( C & c, boost::string_view method, boost::json::array const & args )
3838
{
3939
using Fd = boost::describe::describe_members<C,
4040
boost::describe::mod_public | boost::describe::mod_function>;
@@ -46,7 +46,7 @@ template<class C>
4646

4747
if( !found && method == D.name)
4848
{
49-
result = call_impl( c, D.pointer, args.as_array() );
49+
result = call_impl( c, D.pointer, args );
5050
found = true;
5151
}
5252

@@ -80,6 +80,6 @@ BOOST_DESCRIBE_STRUCT(Object, (), (greet, add))
8080
int main()
8181
{
8282
Object obj;
83-
std::cout << call( obj, "greet", {{ "world" }} ) << std::endl;
84-
std::cout << call( obj, "add", {{ 1, 2 }} ) << std::endl;
83+
std::cout << call( obj, "greet", { "world" } ) << std::endl;
84+
std::cout << call( obj, "add", { 1, 2 } ) << std::endl;
8585
}

0 commit comments

Comments
 (0)