Use allocate_shared
This commit is contained in:
parent
ea21d9263a
commit
4138e6be1d
2 changed files with 2 additions and 9 deletions
|
@ -58,10 +58,7 @@ public:
|
|||
// \return Shared pointer to the new message.
|
||||
virtual std::shared_ptr<MessageT> borrow_message()
|
||||
{
|
||||
auto ptr = MessageAllocTraits::allocate(*message_allocator_.get(), 1);
|
||||
MessageAllocTraits::construct(*message_allocator_.get(), ptr);
|
||||
return std::shared_ptr<MessageT>(ptr, message_deleter_);
|
||||
//return std::allocate_shared<MessageT, typename MessageAlloc::allocator_type>(*message_allocator_);
|
||||
return std::allocate_shared<MessageT, MessageAlloc>(*message_allocator_.get());
|
||||
}
|
||||
|
||||
/// Release ownership of the message, which will deallocate it if it has no more owners.
|
||||
|
|
|
@ -137,10 +137,7 @@ public:
|
|||
// \return Shared pointer to the fresh executable.
|
||||
virtual executor::AnyExecutable::SharedPtr instantiate_next_executable()
|
||||
{
|
||||
//return std::make_shared<executor::AnyExecutable>();
|
||||
auto ptr = ExecAllocTraits::allocate(*executable_allocator_.get(), 1);
|
||||
ExecAllocTraits::construct(*executable_allocator_.get(), ptr);
|
||||
return std::shared_ptr<executor::AnyExecutable>(ptr, executable_deleter_);
|
||||
return std::allocate_shared<executor::AnyExecutable>(*executable_allocator_.get());
|
||||
}
|
||||
|
||||
/// Implementation of a general-purpose allocation function.
|
||||
|
@ -190,7 +187,6 @@ public:
|
|||
|
||||
private:
|
||||
std::shared_ptr<ExecAlloc> executable_allocator_;
|
||||
ExecDeleter executable_deleter_;
|
||||
std::shared_ptr<VoidAlloc> allocator_;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue