1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/container for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #ifndef BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP
12 #define BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP
14 #if defined (_MSC_VER)
18 #include <boost/container/detail/config_begin.hpp>
19 #include <boost/container/detail/workaround.hpp>
20 #include <boost/container/detail/auto_link.hpp>
29 class memory_resource;
32 //! <b>Returns</b>: A pointer to a static-duration object of a type derived from
33 //! memory_resource that can serve as a resource for allocating memory using
34 //! global `operator new` and global `operator delete`. The same value is returned every time this function
35 //! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p.
36 BOOST_CONTAINER_DECL memory_resource* new_delete_resource() BOOST_NOEXCEPT;
38 //! <b>Returns</b>: A pointer to a static-duration object of a type derived from
39 //! memory_resource for which allocate() always throws bad_alloc and for which
40 //! deallocate() has no effect. The same value is returned every time this function
41 //! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p.
42 BOOST_CONTAINER_DECL memory_resource* null_memory_resource() BOOST_NOEXCEPT;
44 //! <b>Effects</b>: If r is non-null, sets the value of the default memory resource
45 //! pointer to r, otherwise sets the default memory resource pointer to new_delete_resource().
47 //! <b>Postconditions</b>: get_default_resource() == r.
49 //! <b>Returns</b>: The previous value of the default memory resource pointer.
51 //! <b>Remarks</b>: Calling the set_default_resource and get_default_resource functions shall
52 //! not incur a data race. A call to the set_default_resource function shall synchronize
53 //! with subsequent calls to the set_default_resource and get_default_resource functions.
54 BOOST_CONTAINER_DECL memory_resource* set_default_resource(memory_resource* r) BOOST_NOEXCEPT;
56 //! <b>Returns</b>: The current value of the default
57 //! memory resource pointer.
58 BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT;
61 } //namespace container {
64 #include <boost/container/detail/config_end.hpp>
66 #endif //BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP