Skip to content

Commit

Permalink
Just in case adding is_base_of check for up-casting-ctor of our int…
Browse files Browse the repository at this point in the history
…erface deleter.

"just in case" b/c `std::unique_ptr` is not allowing invalid casting in the first place,
but I believe such change makes it more explicit (and it was asked for in the first draft review).
  • Loading branch information
serges147 committed May 29, 2024
1 parent 9523cde commit dc36c60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/cetl/pmr/interface_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class PmrInterfaceDeleter final
{
}

template <typename Down>
template <typename Down, typename = std::enable_if_t<std::is_base_of<Interface, Down>::value>>
PmrInterfaceDeleter(const PmrInterfaceDeleter<Down>& other)
: deleter_{other.get_memory_resource(), [other](Interface* ptr) {
// Delegate to the down class deleter.
Expand Down

0 comments on commit dc36c60

Please sign in to comment.