Skip to content

Commit 8d827e7

Browse files
committed
Update nlohmann/json adapters
1 parent 79a741b commit 8d827e7

File tree

3 files changed

+11361
-9521
lines changed

3 files changed

+11361
-9521
lines changed

contrib/nlohmann.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ namespace tao
1616
{
1717
void unit_test()
1818
{
19-
tao::json::nlohmann::to_value value_consumer;
20-
tao::json::events::from_string( "[ null, true, false, 42, 43.0, \"foo\", [ 1, 2, 3 ], { \"a\" : \"b\", \"c\" : \"d\" } ]", value_consumer );
19+
tao::json::nlohmann::to_value<::nlohmann::json > value_consumer;
20+
tao::json::events::from_string( value_consumer, "[ null, true, false, 42, 43.0, \"foo\", [ 1, 2, 3 ], { \"a\" : \"b\", \"c\" : \"d\" } ]" );
2121

2222
const auto& v = value_consumer.value;
2323

@@ -40,7 +40,7 @@ namespace tao
4040
TEST_ASSERT( v[ 7 ].at( "c" ) == "d" );
4141

4242
tao::json::events::to_string output_consumer;
43-
tao::json::nlohmann::from_value( v, output_consumer );
43+
tao::json::nlohmann::from_value( output_consumer, v );
4444

4545
TEST_ASSERT( output_consumer.value() == "[null,true,false,42,43.0,\"foo\",[1,2,3],{\"a\":\"b\",\"c\":\"d\"}]" );
4646
}

contrib/nlohmann/from_value.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ namespace tao
1616
{
1717
// Events producer from an nlohmann/json value.
1818

19-
template< typename Value, typename Consumer >
20-
void from_value( const Value& v, Consumer& consumer )
19+
template< typename Consumer, typename Value >
20+
void from_value( Consumer& consumer, const Value& v )
2121
{
2222
switch( v.type() ) {
2323
case Value::value_t::discarded:

0 commit comments

Comments
 (0)