diff --git a/doc/container.qbk b/doc/container.qbk index 0cc8bb4..8bdc11f 100644 --- a/doc/container.qbk +++ b/doc/container.qbk @@ -1319,6 +1319,13 @@ use [*Boost.Container]? There are several reasons for that: [section:release_notes Release Notes] +[section:release_notes_boost_1_74_00 Boost 1.74 Release] + +* Fixed bugs: + * [@https://github.com/boostorg/container/pull/148 GitHub #148: ['"Fix static initialization issues in pmr global resources"]]. + +[endsect] + [section:release_notes_boost_1_73_00 Boost 1.73 Release] * Fixed bugs: diff --git a/src/global_resource.cpp b/src/global_resource.cpp index df9c688..6160cea 100644 --- a/src/global_resource.cpp +++ b/src/global_resource.cpp @@ -14,6 +14,7 @@ #include #include #include //For global lock +#include #include #include @@ -38,7 +39,7 @@ class new_delete_resource_imp virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT { return &other == this; } -} new_delete_resource_instance; +}; struct null_memory_resource_imp : public memory_resource @@ -60,19 +61,20 @@ struct null_memory_resource_imp virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT { return &other == this; } -} null_memory_resource_instance; +}; BOOST_CONTAINER_DECL memory_resource* new_delete_resource() BOOST_NOEXCEPT { - return &new_delete_resource_instance; + return &boost::container::dtl::singleton_default::instance(); } BOOST_CONTAINER_DECL memory_resource* null_memory_resource() BOOST_NOEXCEPT { - return &null_memory_resource_instance; + return &boost::container::dtl::singleton_default::instance(); } -static memory_resource *default_memory_resource = &new_delete_resource_instance; +static memory_resource *default_memory_resource = + &boost::container::dtl::singleton_default::instance(); BOOST_CONTAINER_DECL memory_resource* set_default_resource(memory_resource* r) BOOST_NOEXCEPT {