diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2021-11-20 18:34:21 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2021-11-20 18:34:21 +0100 |
commit | ede972a70c6d93d68a828b6e84240e1a5fa547a0 (patch) | |
tree | 8eb385c45b4d4f16634e9fad6cd0043d845ecf0d | |
parent | 9ee0390203c38e5921dac2e04905df449915775f (diff) |
compat/macros: pass trivial types by value in cv_qualified<t>
-rw-r--r-- | compat/macros.hpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/compat/macros.hpp b/compat/macros.hpp index 497933cf..f40d7c7a 100644 --- a/compat/macros.hpp +++ b/compat/macros.hpp @@ -20,6 +20,7 @@ template<typename t> using to_const_ref_t = std::add_lvalue_reference_t<std::add_const_t<remove_cvref_t<t>>>; template<typename t> -using cv_qualified = std::conditional_t<std::is_fundamental_v<remove_cvref_t<t>>, +using cv_qualified = std::conditional_t<sizeof(remove_cvref_t<t>) <= sizeof(void*)*4 && std::is_trivially_copyable_v<t> || + std::is_fundamental_v<remove_cvref_t<t>>, remove_cvref_t<t>, to_const_ref_t<t>>; |