laudrup / boost-wintls

Native Windows TLS stream wrapper for use with Asio
https://wintls.dev
Boost Software License 1.0
55 stars 13 forks source link

Remove functional include and use unique_ptr more efficiently #76

Closed jens-diewald closed 1 year ago

jens-diewald commented 1 year ago

A technicality i came across while looking through the code. If a unique_ptr type is always used with the same deleter function, it should be part of the deleter type instead of using function pointers or even std::function. This has the advantage, that we do not have to repeat the deleter function for every instantiation and it is also a little more efficient, as not every unique_ptr has to save the additional function pointer or function object within it. (sizeof(cert_context_ptr) is now 8 and was 16 before.)

laudrup commented 1 year ago

Sorry, I had completely forgotten about this.

Looks really great. Thanks a lot for your contribution.