Skip to content

Commit

Permalink
remove deprecated init-list behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
grisumbras committed Sep 18, 2024
1 parent 019577c commit 906bf1a
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 18 deletions.
2 changes: 0 additions & 2 deletions include/boost/json/impl/value.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -238,15 +238,13 @@ value(
}
else
{
#ifndef BOOST_JSON_LEGACY_INIT_LIST_BEHAVIOR
if( init.size() == 1 )
{
::new(&sca_) scalar();
value temp = init.begin()->make_value( std::move(sp) );
swap(temp);
}
else
#endif
{
::new(&arr_) array(
value_ref::make_array(
Expand Down
14 changes: 0 additions & 14 deletions include/boost/json/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,20 +1029,6 @@ class value
@param sp A pointer to the `boost::container::pmr::memory_resource` to
use. The container will acquire shared ownership of the memory
resource.
@par Note
The previous behavior of this constructor was to always
construct either an @ref object or an @ref array. In practice though,
several C++ implementations did not treat `value{x}` as a constructor
from initializer list. This effectively resulted in different behavior
on different implementations. <br>
If you need the legacy behavior define macro
`BOOST_JSON_LEGACY_INIT_LIST_BEHAVIOR` when you are building the
library. The macro and the functionality will be deprecated in the
future and then removed, so we urge you to change your code for the new
behavior as soon as possible. The simplest way to create an @ref array
with 1 element using an initializer list is via `array{x}`.
*/
BOOST_JSON_DECL
value(
Expand Down
2 changes: 0 additions & 2 deletions test/value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2398,7 +2398,6 @@ class value_test
BOOST_TEST(( jv6 == array{1,2} ));
}
{
#ifndef BOOST_JSON_LEGACY_INIT_LIST_BEHAVIOR
value jv1{0};
BOOST_TEST( jv1 == 0 );

Expand All @@ -2408,7 +2407,6 @@ class value_test
value jv3 = value{0};
BOOST_TEST( jv3 == 0 );

#endif
value jv4{{0}};
BOOST_TEST( jv4 == array{0} );

Expand Down

0 comments on commit 906bf1a

Please sign in to comment.