본문 바로가기

C++20/Language9

[C++20 - Language] Chapter 09. using enum in Local Scopes GitHub : https://github.com/developeSHG/CPP20-Language/commit/572b234b3ae4224a14d3d8c1e6be1cb0669745f7 using enum in Local Scopes · developeSHG/CPP20-Language@572b234 developeSHG committed Jul 28, 2023 github.com 지역 범위에서도 using enum을 사용할 수 있다. #include using namespace std; #include #include #include #include #include #include #include #include // 오늘의 주제 : using enum in Local Scopes // 지역 범위에서도 u.. 2023. 7. 28.
[C++20 - Language] Chapter 08. Ranged-Based For With Initializer GitHub : https://github.com/developeSHG/CPP20-Language/commit/4c6659245e232ea11de584fa3f887cfb7b294f28 Range-Based For Loop With Initializer · developeSHG/CPP20-Language@4c66592 developeSHG committed Jul 28, 2023 github.com 범위 기반 루프문에 대해서도 이니셜라이저를 사용하게 될 수 있다. #include using namespace std; #include #include #include #include #include #include #include #include // 오늘의 주제 : Range-Based For Loop Wi.. 2023. 7. 28.
[C++20 - Language] Chapter 07. Attribute GitHub : https://github.com/developeSHG/CPP20-Language/commit/c46e09e7366f9737c0044379b7ba6e38ff911c20 Attribute · developeSHG/CPP20-Language@c46e09e developeSHG committed Jul 28, 2023 github.com 힌트를 줘서 추가적으로 컴파일러가 warning을 잡아주는 기능. 컴파일러한테 걸어주는 주석같은 느낌. #include using namespace std; #include #include #include #include #include #include #include #include // 오늘의 주제 : Attribute // 힌트를 줘서 추가적으로 컴파일러.. 2023. 7. 28.
[C++20 - Language] Chapter 06. Template Parameter for Lambda GitHub : https://github.com/developeSHG/CPP20-Language/commit/5bc08499e32d6f494c62d23587c2900f65e4f1e4 Template Parameter for Lambda · developeSHG/CPP20-Language@5bc0849 developeSHG committed Jul 28, 2023 github.com 템플릿을 람다와 혼합해서 사용할 수 있다. #include using namespace std; #include #include #include #include #include #include #include #include // 오늘의 주제 : Template Parameter for Lambda // 템플릿을 람다와 혼합.. 2023. 7. 28.
[C++20 - Language] Chapter 05. Non-Type Template Parameter GitHub : https://github.com/developeSHG/CPP20-Language/commit/84f811e96a0a5518f76a242fc3ec07777d3067c7 Non-Type Template Parameter · developeSHG/CPP20-Language@84f811e developeSHG committed Jul 28, 2023 github.com 일방적으로 템플릿을 사용할 때, 어떤 타입에 대응해서 치환을 하게끔 설정했는데 경우에 따라서 지정된 타입(int 등)으로도 사용했었다. 그래서 Non-Type에 대해서만 들어갔었는데, C++20로 넘어오면서 추가된 것들이 생겼다. 보다보면 약간 흑마법같은 기능. // Non-Type // - int, enum // - 포인터, .. 2023. 7. 28.
[C++20 - Language] Chapter 04. Conditionally Explicit Constructor (조건부 Explicit 생성자) GitHub : https://github.com/developeSHG/CPP20-Language/commit/522ca880fd24d6328a350e1d6f5454d763eaf260 Conditionally Explicit Constructor (조건부 Explicit 생성자) · developeSHG/CPP20-Language@522ca88 developeSHG committed Jul 27, 2023 github.com #include using namespace std; #include #include #include #include #include #include #include // 오늘의 주제 : Conditionally Explicit Constructor (조건부 Explicit 생성자).. 2023. 7. 28.
[C++20 - Language] Chapter 03. consteval / constinit GitHub : https://github.com/developeSHG/CPP20-Language/commit/d46afb5381c4bd788477d95c80b018f43bb9ca85 consteval / constinit · developeSHG/CPP20-Language@d46afb5 developeSHG committed Jul 27, 2023 github.com consteval, constinit // const 들을 비교해보기 전에 밑의 개념을 알고가자. // 컴파일 타임 vs 런타임 // 컴파일 -> 실행파일(exe) -> 런타임 // 정리하자면 C++ 코드를 컴파일러가 번역해서 바이너리 파일로 만들어 준 후, // 경과물들을 링크 단계를 거쳐서 최종적으로 실행파일을 만들게 된다. // 그리.. 2023. 7. 28.
[C++20 - Language] Chapter 02. Designated Initialization (지정 초기화) GitHub : https://github.com/developeSHG/CPP20-Language/commit/d3b68fe794104dd00e3242e26efde06e206fb046 Designated Initialization (지정 초기화) · developeSHG/CPP20-Language@d3b68fe developeSHG committed Jul 27, 2023 github.com #include using namespace std; #include #include #include #include #include #include #include // 오늘의 주제 : Designated Initialization (지정 초기화) struct Pos2D { int x; int y; }; class.. 2023. 7. 28.
[C++20 - Language] Chapter 01. Three-Way Comparison 연산자 (Spaceship Operator <=> ) GitHub :https://github.com/developeSHG/CPP20-Language/commit/f711b3b8cfbbd4f83d077c81743b4a034b47ba83 Three-Way Comparison 연산자 (Spaceship Operator ) · developeSHG/CPP20-Language@f711b3b developeSHG committed Jul 27, 2023 github.com // = == != // 보통 = == != // 보통 < 로 연산자 오버로딩을 하면 위의 수식도 필요한게 일반적. // 저것을 다 정의하는 것보다, 알아서 자동으로 해줄 수 있게 지원하는 게 Spaceship Operator bool operator b; bool test3 = a b 중 하나는.. 2023. 7. 26.