mqtt_cpp
Typedefs | Functions
shared_ptr_array.hpp File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

using shared_ptr_array = std::shared_ptr< char[]>
 Type alias of shared_ptr char array. You can choose the target type. More...
 
using const_shared_ptr_array = std::shared_ptr< char const[]>
 

Functions

shared_ptr_array make_shared_ptr_array (std::size_t size)
 shared_ptr_array creating function. You can choose the target type. More...
 

Typedef Documentation

◆ const_shared_ptr_array

using const_shared_ptr_array = std::shared_ptr<char const []>

◆ shared_ptr_array

using shared_ptr_array = std::shared_ptr<char []>

Type alias of shared_ptr char array. You can choose the target type.

  • If MQTT_STD_SHARED_PTR_ARRAY is defined, std::shared_ptr<char []> is used.
    • std::shared_ptr<char []> is supported since C++17.
  • If MQTT_STD_SHARED_PTR_ARRAY is not defined (default), boost::shared_ptr<char []> is used.
    • boost::shared_ptr<char []> can be used on C++14.

Function Documentation

◆ make_shared_ptr_array()

shared_ptr_array make_shared_ptr_array ( std::size_t  size)
inline

shared_ptr_array creating function. You can choose the target type.

  • If MQTT_STD_SHARED_PTR_ARRAY is defined,
    • and 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.
  • If MQTT_STD_SHARED_PTR_ARRAY is not defined (default), then boost::make_shared<char[]>(size) is used.
    • It can allocate an array of characters and the control block in a single allocation.