[libcxx-commits] [libcxx] [libc++] Implement std::move_only_function (P0288R9) (PR #94670)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 21 08:21:02 PST 2025


================
@@ -38,8 +39,10 @@
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 template <size_t _BufferSize, size_t _BufferAlignment>
-  requires(_BufferSize > 0 && _BufferAlignment > 0)
 class __small_buffer {
+  static_assert(std::has_single_bit(_BufferAlignment), "Alignment is invalid.");
+  static_assert(_BufferSize >= sizeof(byte*), "Buffer has to be capable of storing a pointer for heap allocations!");
+
 public:
   template <class _Tp, class _Decayed = decay_t<_Tp>>
   static constexpr bool __fits_in_buffer =
----------------
ldionne wrote:

Let's at least add a comment that we pedantically would need `is_trivially_copyable` since we're memcpying around, but we don't because we do similar tricks for our trivial relocation emulation.

https://github.com/llvm/llvm-project/pull/94670


More information about the libcxx-commits mailing list