]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | ||
22 | #include <cstddef> | |
23 | ||
24 | namespace boost { | |
25 | namespace container { | |
26 | namespace pmr { | |
27 | ||
28 | /// @cond | |
29 | class memory_resource; | |
30 | /// @endcond | |
31 | ||
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; | |
37 | ||
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; | |
43 | ||
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(). | |
46 | //! | |
47 | //! <b>Postconditions</b>: get_default_resource() == r. | |
48 | //! | |
49 | //! <b>Returns</b>: The previous value of the default memory resource pointer. | |
50 | //! | |
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; | |
55 | ||
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; | |
59 | ||
60 | } //namespace pmr { | |
61 | } //namespace container { | |
62 | } //namespace boost { | |
63 | ||
64 | #include <boost/container/detail/config_end.hpp> | |
65 | ||
66 | #endif //BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP |