C++(23)
-
More C++ Idioms (79. SFINAE - Substitution Failure Is Not An Error)
출처: https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/SFINAE More C++ Idioms/SFINAE - Wikibooks, open books for an open worldFrom Wikibooks, open books for an open world Jump to navigation Jump to search Prune functions that do not yield valid template instantiations from a set of overloaded functions. Substitution Failure Is Not An Error Strictly, SFINAE is a language feature aen.wikibooks.org ..
2024.08.28 -
More C++ Idioms (55. Named Parameter)
출처: https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Named_Parameter More C++ Idioms/Named Parameter - Wikibooks, open books for an open worldFrom Wikibooks, open books for an open world Jump to navigation Jump to search Simulate named (key-value pair) parameter passing style found in other languages instead of position-based parameters. Method chaining, Fluent interface When a function takes m..
2024.08.11 -
More C++ Idioms (44. Int-To-Type, Int2Type)
https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Int-To-Type More C++ Idioms/Int-To-Type - Wikibooks, open books for an open worldFrom Wikibooks, open books for an open world Jump to navigation Jump to search To treat an integral constant as a type at compile-time. To achieve static call dispatch based on constant integral values. Integral constant wrappers Function overloading in C+en.wikibook..
2024.08.05 -
std::is_empty - empty class (C++11~)
출처: https://en.cppreference.com/w/cpp/types/is_empty struct is_empty; (since C++11) std::is_empty is a UnaryTypeTrait. If T is an empty type (that is, a non-union class type with no non-static data members other than bit-fields of size 0, no virtual functions, no virtual base classes, and" data-og-host="en.cppreference.com" data-og-source-url="https://en.cppreference.com/w/cpp/types/is_empty" da..
2024.08.04 -
Variable template specialization (C++14 ~)
C++14에서 도입된 기능으로, 변수도 템플릿으로 정의하고 특정 타입에 대해 특수화할 수 있게 해준다.이를 기반으로 타입에 대한 서로 다른 값을 가지는 변수를 정의할 수 있다. 다양한 타입에 대해 서로 다른 값을 가지는 상수나 설정값을 정의할 수 있어, 코드의 가독성이 높아지고 유지보수가 유리해진다. 예제는 ChatGPT를 사용해서 생성해 보았다. 예시 1: 기본 변수 템플릿templateconstexpr T pi = T(3.1415926535897932385); 변수 템플릿 특수화templateconstexpr int pi = 3;타입이 int이면 pi로 정수형 '3'의 값을 가지게 된다. 이 예제를 전체 코드로 보면#include // 변수 템플릿 정의templateconstexpr T pi = T(..
2024.08.04