Skip to content

Commit ab1a679

Browse files
net: Tried avoid allocating deleter
1 parent dc31adc commit ab1a679

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

api/net/inet_common.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ namespace net {
5050
}
5151

5252

53-
template<typename Derived, typename Base, typename Del>
54-
auto static_unique_ptr_cast( std::unique_ptr<Base, Del>&& p )
53+
template<typename Derived, typename Base>
54+
auto static_unique_ptr_cast( std::unique_ptr<Base>&& p )
5555
{
5656
auto* d = static_cast<Derived *>(p.release());
57-
return std::unique_ptr<Derived, Del>(d, std::move(p.get_deleter()));
57+
return std::unique_ptr<Derived>(d);
5858
}
5959

6060
} //< namespace net

api/net/packet.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace net
4848
bufstore (bs)
4949
{}
5050

51-
~Packet()
51+
virtual ~Packet()
5252
{
5353
if (bufstore)
5454
bufstore->release(this);

api/net/tcp/common.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ namespace net {
5454
{ return buffer_t(new uint8_t[length], std::default_delete<uint8_t[]>()); }
5555

5656
class Packet;
57-
using Packet_ptr = std::unique_ptr<Packet, std::default_delete<net::Packet>>;
57+
using Packet_ptr = std::unique_ptr<Packet>;
5858

5959
class Connection;
6060
using Connection_ptr = std::shared_ptr<Connection>;

0 commit comments

Comments
 (0)