pool_options.hpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. #ifndef BOOST_CONTAINER_PMR_POOL_OPTIONS_HPP
  11. #define BOOST_CONTAINER_PMR_POOL_OPTIONS_HPP
  12. #if defined (_MSC_VER)
  13. # pragma once
  14. #endif
  15. #include <cstddef>
  16. namespace boost {
  17. namespace container {
  18. namespace pmr {
  19. //! The members of pool_options comprise a set of constructor options for pool resources.
  20. //! The effect of each option on the pool resource behavior is described below:
  21. //!
  22. //! - `std::size_t max_blocks_per_chunk`: The maximum number of blocks that will be allocated
  23. //! at once from the upstream memory resource to replenish a pool. If the value of
  24. //! `max_blocks_per_chunk` is zero or is greater than an implementation-defined limit,
  25. //! that limit is used instead. The implementation may choose to use a smaller value
  26. //! than is specified in this field and may use different values for different pools.
  27. //!
  28. //! - `std::size_t largest_required_pool_block`: The largest allocation size that is required
  29. //! to be fulfilled using the pooling mechanism. Attempts to allocate a single block
  30. //! larger than this threshold will be allocated directly from the upstream memory
  31. //! resource. If largest_required_pool_block is zero or is greater than an
  32. //! implementation-defined limit, that limit is used instead. The implementation may
  33. //! choose a pass-through threshold larger than specified in this field.
  34. struct pool_options
  35. {
  36. pool_options()
  37. : max_blocks_per_chunk(0u), largest_required_pool_block(0u)
  38. {}
  39. std::size_t max_blocks_per_chunk;
  40. std::size_t largest_required_pool_block;
  41. };
  42. } //namespace pmr {
  43. } //namespace container {
  44. } //namespace boost {
  45. #endif //BOOST_CONTAINER_PMR_POOL_OPTIONS_HPP