Moved checked deleters into internal namespace to block unintended ADL.

This prevents adding namespace boost to ADL when the deleters are used
in template parameters, e.g. in std::unique_ptr.
This commit is contained in:
Andrey Semashev
2024-02-07 15:12:36 +03:00
parent 76401063a6
commit 0fb4d92d83
5 changed files with 76 additions and 3 deletions

View File

@@ -60,6 +60,10 @@ template<class T> inline void checked_array_delete(T * x) BOOST_NOEXCEPT
delete [] x;
}
// Block unintended ADL
namespace checked_deleters
{
template<class T> struct checked_deleter
{
typedef void result_type;
@@ -83,6 +87,11 @@ template<class T> struct checked_array_deleter
}
};
} // namespace checked_deleters
using checked_deleters::checked_deleter;
using checked_deleters::checked_array_deleter;
} // namespace boost
#endif // #ifndef BOOST_CORE_CHECKED_DELETE_HPP