[libcxx-commits] [libcxx] [libc++] Add __pointer_int_pair (PR #94324)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 6 16:42:28 PDT 2024


EricWF wrote:

> Out of interest, how is this useful in the implementation of move_only_function ? I was thinking of
> 
> union { void* heap_callable_, alignas(void*) unsigned char buffer_[N] }
> 
> const vtable* vtable_
> 
> Where vtable contains call move Destroy
> 
> We don’t seem to need a bool because the vtable function implementation should deal with question whether or not the object is in the buffer or in the heap

You mean specifically that we can have a null vtable when there's no function contained? That makes sense to me.

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


More information about the libcxx-commits mailing list