TartanLlama / function_ref

A lightweight, non-owning reference to a callable.
Creative Commons Zero v1.0 Universal
169 stars 23 forks source link

function_ref should be trivially copyable #8

Closed Quuxplusone closed 5 years ago

Quuxplusone commented 5 years ago
// https://godbolt.org/z/HnagzZ
#include <https://raw.githubusercontent.com/tartanllama/function_ref/master/function_ref.hpp>

static_assert(std::is_trivially_copyable_v<tl::function_ref<void()>>); // FAILS

I see no reason function_ref shouldn't be trivially copyable.

ABI breakage warning — but better to break now than break later! :) Also, @superv1234 informs me that the Standard-proposed version of function_ref will be trivially copyable in the next revision (because other people have had the same comment).