구조체 B가 커스텀 복사 생성자를 만들어서 std::is_trivially_copyable_v가 false가 나오는데 실제로는 trivially copy 해도 상관없는 구조잖아
그래서 std::is_trivially_copyable_v가 true가 나오도록 만들고싶다 치면 그냥 std::is_trivially_copy 특수화 추가하는 수밖에 없음?
구조체 B가 커스텀 복사 생성자를 만들어서 std::is_trivially_copyable_v가 false가 나오는데 실제로는 trivially copy 해도 상관없는 구조잖아
그래서 std::is_trivially_copyable_v가 true가 나오도록 만들고싶다 치면 그냥 std::is_trivially_copy 특수화 추가하는 수밖에 없음?
std::integral_constant(bool, true) 상속받는 특수화 하세염 물론 실전에서는 특이 동작도 없는 복사 생성자를 디폴트 안쓰고 따로 작성하는게 이상하다는건 알졈? 특이 동작이 있으면 그냥 카피하면 안되니까 당연히 false가 맞고염
링크 잘못해서 다시검
http://eel.is/c++draft/meta
Unless
otherwise specified, the behavior of a program that adds specializations for any of the templates specified in this subclause [meta] is undefined.
It is allowed to add template specializations for any standard library class (since C++20)template to the namespace std only if the declaration depends on at least one program-defined type and the specialization satisfies all requirements for the original template, except where such specializations are prohibited.
https://en.cppreference.com/w/cpp/language/extending_std
td::is_trivially_copyable이 c++20 기준 조건에서 특수화 추가하면 안될 이유가 있나
C++20 latest WD n4849 - 20.15.1 Requirements Unless otherwise specified, the behavior of a program that adds specializations for any of the templates specified in this subclause 20.15 is undefined. 그룰은 function template specialization 밴하는대신 쓰라고 개정된거라 type_traits 라이브러리의 rule을 override 하진 않을거같음
16.5.4.2.1 Namespace std Unless explicitly prohibited, a program may add a template specialization for any standard library class template to namespace std provided that (a) the added declaration depends on at least one program-defined type and (b) the specialization meets the standard library requirements for the original template
20.15.1에서 explicitly prohibit했다고 볼수 있으니 type_traits 라이브러리에 한에선 16.5.4.2.1의 룰이 적용이안된다고 해석할수 있을듯.