Update return by value threshold in gsl::not_null (#1205)

- Allow returning by value for types that are not greater than two pointers in size
This commit is contained in:
ozaktash
2025-05-12 19:02:03 +02:00
committed by GitHub
parent 3325bbd33d
commit 466e4ebaa5

View File

@@ -54,7 +54,7 @@ namespace details
// Copied from cppfront's implementation of the CppCoreGuidelines F.16 (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in) // Copied from cppfront's implementation of the CppCoreGuidelines F.16 (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in)
template<typename T> template<typename T>
using value_or_reference_return_t = std::conditional_t< using value_or_reference_return_t = std::conditional_t<
sizeof(T) < 2*sizeof(void*) && std::is_trivially_copy_constructible<T>::value, sizeof(T) <= 2*sizeof(void*) && std::is_trivially_copy_constructible<T>::value,
const T, const T,
const T&>; const T&>;