/usr/include/boost/container/pmr
NameSizeModeActions
deque.hpp11600644editdlrm
flat_map.hpp18830644editdlrm
flat_set.hpp17340644editdlrm
global_resource.hpp27310644editdlrm
list.hpp11530644editdlrm
map.hpp19920644editdlrm
memory_resource.hpp48450644editdlrm
monotonic_buffer_resource.hpp82450644editdlrm
polymorphic_allocator.hpp61890644editdlrm
pool_options.hpp20830644editdlrm
resource_adaptor.hpp99260644editdlrm
set.hpp18200644editdlrm
slist.hpp11610644editdlrm
small_vector.hpp12590644editdlrm
stable_vector.hpp12320644editdlrm
string.hpp14230644editdlrm
synchronized_pool_resource.hpp61390644editdlrm
unsynchronized_pool_resource.hpp85960644editdlrm
vector.hpp11690644editdlrm
Edit: /usr/include/boost/container/pmr/memory_resource.hpp (4845B)
////////////////////////////////////////////////////////////////////////////// // // (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_MEMORY_RESOURCE_HPP #define BOOST_CONTAINER_PMR_MEMORY_RESOURCE_HPP #if defined (_MSC_VER) # pragma once #endif #include #include #include #include #include namespace boost { namespace container { namespace pmr { //! The memory_resource class is an abstract interface to an //! unbounded set of classes encapsulating memory resources. class BOOST_CONTAINER_DECL memory_resource { public: // For exposition only static BOOST_CONSTEXPR_OR_CONST std::size_t max_align = boost::move_detail::alignment_of::value; //! Effects: Destroys //! this memory_resource. virtual ~memory_resource(){} //! Effects: Equivalent to //! `return do_allocate(bytes, alignment);` void* allocate(std::size_t bytes, std::size_t alignment = max_align) { return this->do_allocate(bytes, alignment); } //! Effects: Equivalent to //! `return do_deallocate(bytes, alignment);` void deallocate(void* p, std::size_t bytes, std::size_t alignment = max_align) { return this->do_deallocate(p, bytes, alignment); } //! Effects: Equivalent to //! `return return do_is_equal(other);` bool is_equal(const memory_resource& other) const BOOST_NOEXCEPT { return this->do_is_equal(other); } #if !defined(BOOST_EMBTC) //! Returns: //! `&a == &b || a.is_equal(b)`. friend bool operator==(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT { return &a == &b || a.is_equal(b); } //! Returns: //! !(a == b). friend bool operator!=(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT { return !(a == b); } #else //! Returns: //! `&a == &b || a.is_equal(b)`. friend bool operator==(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT; //! Returns: //! !(a == b). friend bool operator!=(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT; #endif protected: //! Requires: Alignment shall be a power of two. //! //! Returns: A derived class shall implement this function to return a pointer //! to allocated storage with a size of at least bytes. The returned storage is //! aligned to the specified alignment, if such alignment is supported; otherwise //! it is aligned to max_align. //! //! Throws: A derived class implementation shall throw an appropriate exception if //! it is unable to allocate memory with the requested size and alignment. virtual void* do_allocate(std::size_t bytes, std::size_t alignment) = 0; //! Requires: p shall have been returned from a prior call to //! `allocate(bytes, alignment)` on a memory resource equal to *this, and the storage //! at p shall not yet have been deallocated. //! //! Effects: A derived class shall implement this function to dispose of allocated storage. //! //! Throws: Nothing. virtual void do_deallocate(void* p, std::size_t bytes, std::size_t alignment) = 0; //! Returns: A derived class shall implement this function to return true if memory //! allocated from this can be deallocated from other and vice-versa; otherwise it shall //! return false. [Note: The most-derived type of other might not match the type of this. //! For a derived class, D, a typical implementation of this function will compute //! `dynamic_cast(&other)` and go no further (i.e., return false) //! if it returns nullptr. - end note]. virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT = 0; }; #if defined(BOOST_EMBTC) //! Returns: //! `&a == &b || a.is_equal(b)`. inline bool operator==(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT { return &a == &b || a.is_equal(b); } //! Returns: //! !(a == b). inline bool operator!=(const memory_resource& a, const memory_resource& b) BOOST_NOEXCEPT { return !(a == b); } #endif } //namespace pmr { } //namespace container { } //namespace boost { #include #endif //BOOST_CONTAINER_PMR_MEMORY_RESOURCE_HPP