diff options
Diffstat (limited to 'boost/container/pmr/global_resource.hpp')
-rw-r--r-- | boost/container/pmr/global_resource.hpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/boost/container/pmr/global_resource.hpp b/boost/container/pmr/global_resource.hpp new file mode 100644 index 0000000000..219309b072 --- /dev/null +++ b/boost/container/pmr/global_resource.hpp @@ -0,0 +1,66 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP +#define BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP + +#if defined (_MSC_VER) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/detail/auto_link.hpp> + +#include <cstddef> + +namespace boost { +namespace container { +namespace pmr { + +/// @cond +class memory_resource; +/// @endcond + +//! <b>Returns</b>: A pointer to a static-duration object of a type derived from +//! memory_resource that can serve as a resource for allocating memory using +//! global `operator new` and global `operator delete`. The same value is returned every time this function +//! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p. +BOOST_CONTAINER_DECL memory_resource* new_delete_resource() BOOST_NOEXCEPT; + +//! <b>Returns</b>: A pointer to a static-duration object of a type derived from +//! memory_resource for which allocate() always throws bad_alloc and for which +//! deallocate() has no effect. The same value is returned every time this function +//! is called. For return value p and memory resource r, p->is_equal(r) returns &r == p. +BOOST_CONTAINER_DECL memory_resource* null_memory_resource() BOOST_NOEXCEPT; + +//! <b>Effects</b>: If r is non-null, sets the value of the default memory resource +//! pointer to r, otherwise sets the default memory resource pointer to new_delete_resource(). +//! +//! <b>Postconditions</b>: get_default_resource() == r. +//! +//! <b>Returns</b>: The previous value of the default memory resource pointer. +//! +//! <b>Remarks</b>: Calling the set_default_resource and get_default_resource functions shall +//! not incur a data race. A call to the set_default_resource function shall synchronize +//! with subsequent calls to the set_default_resource and get_default_resource functions. +BOOST_CONTAINER_DECL memory_resource* set_default_resource(memory_resource* r) BOOST_NOEXCEPT; + +//! <b>Returns</b>: The current value of the default +//! memory resource pointer. +BOOST_CONTAINER_DECL memory_resource* get_default_resource() BOOST_NOEXCEPT; + +} //namespace pmr { +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //BOOST_CONTAINER_PMR_GLOBAL_RESOURCE_HPP |