std::pmr::m...er_resource(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

std::pmr::monotonic_buffer_resource::monotonic_buffer_resource β€” std::pmr::monotonic_buffer_resource::monotonic_buffer_resource. Yep, the constructor is named exactly like the class; main character energy only. This page is std::pmr::m...er_resource(3) from the C++ Standard Libary manual β€” and yes, that's the manual name up top, typo included, we preserve it πŸ’….

✨ Synopsis ✨

Okay so here's the overload lineup, and every single one is (since C++17):

  • Overload (1) β€” (since C++17) β€” monotonic_buffer_resource();
  • Overload (2) β€” (since C++17) β€” explicit monotonic_buffer_resource( std::pmr::memory_resource* upstream );
  • Overload (3) β€” (since C++17) β€” explicit monotonic_buffer_resource( std::size_t initial_size );
  • Overload (4) β€” (since C++17) β€” monotonic_buffer_resource( std::size_t initial_size, std::pmr::memory_resource* upstream );
  • Overload (5) β€” (since C++17) β€” monotonic_buffer_resource( void* buffer, std::size_t buffer_size );
  • Overload (6) β€” (since C++17) β€” monotonic_buffer_resource( void* buffer, std::size_t buffer_size, std::pmr::memory_resource* upstream );
  • Overload (7) β€” (since C++17) β€” monotonic_buffer_resource( const monotonic_buffer_resource& ) = delete;

Now the deets, because this constructor has lore. It constructs a monotonic_buffer_resource. The constructors that do not take an upstream memory resource pointer use the return value of std::pmr::get_default_resource as the upstream memory resource. That's the default-resource pipeline, iykyk.

  • 1,2) Sets the current buffer to null and the next buffer size to an implementation-defined size.
  • 3,4) Sets the current buffer to null and the next buffer size to a size no smaller than initial_size.
  • 5,6) Sets the current buffer to buffer and the next buffer size to buffer_size (but not less than 1). Then increase the next buffer size by an implementation-defined growth factor (which does not have to be integral).
  • 7) Copy constructor is deleted.

πŸŽ€ Parameters πŸŽ€

  • upstream β€” the upstream memory resource to use; it must point to a valid memory resource.
  • initial_size β€” the minimum size of the first buffer to allocate; it must be greater than zero.
  • buffer β€” the initial buffer to use.
  • buffer_size β€” the size of the initial buffer; it cannot be greater than the number of bytes in buffer.
🚨 Constraint check, bestie: upstream has to point to a valid memory resource, initial_size has to be greater than zero, and buffer_size cannot be greater than the number of bytes in buffer. These are not vibes, they're rules. Periodt.

Cute little sign-off: this page came from http://cppreference.com, dated 2024.06.10, and it's the std::pmr::m...er_resource(3) page. Go forth and construct your monotonic buffer resource, icon πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from