Fixes #161: ("polymorphic_allocator(memory_resource*) non-standard extension causes headache")

This commit is contained in:
Ion Gaztañaga
2020-08-31 13:37:11 +02:00
parent 438813726b
commit 0b297019ec
3 changed files with 10 additions and 6 deletions

View File

@@ -1338,6 +1338,14 @@ use [*Boost.Container]? There are several reasons for that:
[section:release_notes Release Notes]
[section:release_notes_boost_1_75_00 Boost 1.75 Release]
* New [classref boost::container::devector devector] container.
* Fixed bugs/issues:
* [@https://github.com/boostorg/container/issues/157 GitHub #157: ['"Add missing include"]].
[endsect]
[section:release_notes_boost_1_74_00 Boost 1.74 Release]
* Fixed bugs/issues:

View File

@@ -53,10 +53,9 @@ class polymorphic_allocator
//! <b>Throws</b>: Nothing
//!
//! <b>Notes</b>: This constructor provides an implicit conversion from memory_resource*.
//! Non-standard extension: if r is null m_resource is set to get_default_resource().
polymorphic_allocator(memory_resource* r)
: m_resource(r ? r : ::boost::container::pmr::get_default_resource())
{}
: m_resource(r)
{ BOOST_ASSERT(r != 0); }
//! <b>Effects</b>: Sets m_resource to
//! other.resource().

View File

@@ -25,9 +25,6 @@ void test_default_constructor()
void test_resource_constructor()
{
polymorphic_allocator<int> a(0);
BOOST_TEST(a.resource() == get_default_resource());
derived_from_memory_resource d;
polymorphic_allocator<int> b(&d);
BOOST_TEST(&d == b.resource());