@@ -478,10 +478,10 @@ namespace tao
478478 }
479479 }
480480
481- basic_value & add ( const json_pointer & k )
481+ basic_value & insert ( const json_pointer & k, basic_value value )
482482 {
483483 if ( ! k ) {
484- return * this ;
484+ throw " TODO: Clarify with RFC!!! " ;
485485 }
486486 const auto sp = k.split ();
487487 basic_value & v = internal::json_pointer_at ( this , sp.first );
@@ -490,11 +490,11 @@ namespace tao
490490 {
491491 const auto & t = sp.second ;
492492 if ( t == " -" ) {
493- v.unsafe_emplace_back ( null );
493+ v.unsafe_emplace_back ( std::move ( value ) );
494494 return v.m_union .a .back ();
495495 }
496496 const auto i = internal::json_pointer_token_to_index ( t );
497- v.m_union .a .insert ( v.m_union .a .begin () + i, null );
497+ v.m_union .a .insert ( v.m_union .a .begin () + i, std::move ( value ) );
498498 return v.m_union .a .at ( i );
499499 }
500500 break ;
@@ -503,10 +503,11 @@ namespace tao
503503 auto & t = sp.second ;
504504 const auto it = v.m_union .o .find ( t );
505505 if ( it == v.m_union .o .end () ) {
506- const auto r = v.unsafe_emplace ( std::move ( t ), null );
506+ const auto r = v.unsafe_emplace ( std::move ( t ), std::move ( value ) );
507507 assert ( r.second );
508508 return r.first ->second ;
509509 }
510+ it->second = std::move ( value );
510511 return it->second ;
511512 }
512513 break ;
0 commit comments