1 ////////////////////////////////////////////////////////////////////////////// 2 // 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) 6 // 7 // See http://www.boost.org/libs/container for documentation. 8 // 9 ////////////////////////////////////////////////////////////////////////////// 10 11 #ifndef BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP 12 #define BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP 13 14 #if defined (_MSC_VER) 15 # pragma once 16 #endif 17 18 #include <boost/container/detail/config_begin.hpp> 19 #include <boost/container/detail/workaround.hpp> 20 #include <boost/container/detail/auto_link.hpp> 21 #include <boost/container/container_fwd.hpp> 22 23 #include <cstddef> 24 25 namespace boost { 26 namespace container { 27 namespace pmr { 28 29 //! <b>Returns</b>: A pointer to a static-duration object of a type derived from 30 //! memory_resource that can serve as a resource for allocating memory using 31 //! global `operator new` and global `operator delete`. The same value is returned every time this function 32 //! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p. 33 BOOST_CONTAINER_DECL memory_resource* new_delete_resource() BOOST_NOEXCEPT; 34 35 //! <b>Returns</b>: A pointer to a static-duration object of a type derived from 36 //! memory_resource for which allocate() always throws bad_alloc and for which 37 //! deallocate() has no effect. The same value is returned every time this function 38 //! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p. 39 BOOST_CONTAINER_DECL memory_resource* null_memory_resource() BOOST_NOEXCEPT; 40 41 //! <b>Effects</b>: If r is non-null, sets the value of the default memory resource 42 //! pointer to r, otherwise sets the default memory resource pointer to new_delete_resource(). 43 //! 44 //! <b>Postconditions</b>: get_default_resource() == r. 45 //! 46 //! <b>Returns</b>: The previous value of the default memory resource pointer. 47 //! 48 //! <b>Remarks</b>: Calling the set_default_resource and get_default_resource functions shall 49 //! not incur a data race. A call to the set_default_resource function shall synchronize 50 //! with subsequent calls to the set_default_resource and get_default_resource functions. 51 BOOST_CONTAINER_DECL memory_resource* set_default_resource(memory_resource* r) BOOST_NOEXCEPT; 52 53 //! <b>Returns</b>: The current value of the default 54 //! memory resource pointer. 55 BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT; 56 57 } //namespace pmr { 58 } //namespace container { 59 } //namespace boost { 60 61 #include <boost/container/detail/config_end.hpp> 62 63 #endif //BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP 64