[libcxx-commits] [libcxx] [libc++] Specialize allocator_traits for std::allocator (PR #160278)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Jan 29 02:53:01 PST 2026
================
@@ -338,6 +339,80 @@ struct allocator_traits {
}
};
+template <class _Tp>
+struct allocator_traits<allocator<_Tp> > {
+ using allocator_type = allocator<_Tp>;
----------------
philnik777 wrote:
We do get some of the benefit when only specializing the aliases, but we don't get the full benefit. I've tried switching to `if constexpr` for the implementation of the functions, and that got us most of the way to a full specialization (only ~twice as slow). I think this approach is fine, and we can get the benefit of `if constexpr` here once we drop C++03.
https://github.com/llvm/llvm-project/pull/160278
More information about the libcxx-commits
mailing list