This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Extend aligned_membuf<> usage
On 06/02/2018 20:16, François Dumont wrote:
On 05/02/2018 18:16, Jonathan Wakely wrote:
Wouldn't it make more sense to simply make __aligned_buffer identical
to __aligned_membuf for the versioned-namespace? Then at least the
conditional code is only in one place.
Yes, __aligned_buffer is indeed not used, we could do that. I'll
propose a patch to do so.
So here it is, ok to commit ?
François
diff --git a/libstdc++-v3/include/ext/aligned_buffer.h b/libstdc++-v3/include/ext/aligned_buffer.h
index 94a2ff0..81fb797 100644
--- a/libstdc++-v3/include/ext/aligned_buffer.h
+++ b/libstdc++-v3/include/ext/aligned_buffer.h
@@ -75,6 +75,10 @@ namespace __gnu_cxx
{ return static_cast<const _Tp*>(_M_addr()); }
};
+#if _GLIBCXX_INLINE_VERSION
+ template<typename _Tp>
+ using __aligned_buffer = __aligned_membuf<_Tp>;
+#else
// Similar to __aligned_membuf but aligned for complete objects, not members.
// This type is used in <forward_list>, <future>, <bits/shared_ptr_base.h>
// and <bits/hashtable_policy.h>, but ideally they would use __aligned_membuf
@@ -113,6 +117,7 @@ namespace __gnu_cxx
_M_ptr() const noexcept
{ return static_cast<const _Tp*>(_M_addr()); }
};
+#endif
} // namespace