async_mqtt 9.0.1
Loading...
Searching...
No Matches
Reference counting immutable buffer
Collaboration diagram for Reference counting immutable buffer:

Classes

class  async_mqtt::buffer
 buffer that has string_view interface and shared ownership This class is only for advanced usecase such as developping high performance MQTT broker. Typical MQTT client developpers don't need to care about the buffer. This class provides string_view interface. This class holds string_view pointee's lifetime optionally. More...
 
class  std::hash< async_mqtt::buffer >
 class template hash specilization for the buffer More...
 

Functions

const_buffer boost::asio::buffer (async_mqtt::buffer const &data)
 create boost::asio::const_buffer from the async_mqtt::buffer boost::asio::const_buffer is a kind of view class. So the class doesn't hold any lifetimes. The caller needs to manage data's lifetime.
 
std::shared_ptr< char[]> async_mqtt::make_shared_ptr_char_array (std::size_t size)
 shared_ptr<char[]> creating function. You can choose the target type.
 
template<typename Alloc >
std::shared_ptr< char[]> async_mqtt::allocate_shared_ptr_char_array (Alloc &&alloc, std::size_t size)
 shared_ptr<char[]> creating function with allocator. You can choose the target type.
 

Detailed Description

Function Documentation

◆ allocate_shared_ptr_char_array()

template<typename Alloc >
std::shared_ptr< char[]> async_mqtt::allocate_shared_ptr_char_array ( Alloc && alloc,
std::size_t size )
inline

shared_ptr<char[]> creating function with allocator. You can choose the target type.

  • if your compiler setting is C++20 or later, then std::make_shared<char[]>(size) is used.
    • It can allocate an array of characters and the control block in a single allocation.
  • otherwise std::shared_ptr<char[]>(new char[size]) is used.
    • It requires two times allocations.
      Parameters
      allocallocator
      sizeof char array
      Returns
      shared_ptr of array

◆ buffer()

const_buffer boost::asio::buffer ( async_mqtt::buffer const & data)
inline

create boost::asio::const_buffer from the async_mqtt::buffer boost::asio::const_buffer is a kind of view class. So the class doesn't hold any lifetimes. The caller needs to manage data's lifetime.

Parameters
datasource async_mqtt::buffer
Returns
boost::asio::const_buffer

Requirements

◆ make_shared_ptr_char_array()

std::shared_ptr< char[]> async_mqtt::make_shared_ptr_char_array ( std::size_t size)
inline

shared_ptr<char[]> creating function. You can choose the target type.

  • if your compiler setting is C++20 or later, then std::make_shared<char[]>(size) is used.
    • It can allocate an array of characters and the control block in a single allocation.
  • otherwise std::shared_ptr<char[]>(new char[size]) is used.
    • It requires two times allocations.
      Parameters
      sizeof char array
      Returns
      shared_ptr of array