Patterns and concepts in C ++ 20

Hello, Habr!

Recently Egor Suvorov, teacher of the C ++ course at Petersburg HSE, gave a lecture about some features of the language for the participants All-Russian Olympiad for schoolchildren in computer science. Egor talked about templates in C ++, as well as where and why they arise: generic programming of data structures and algorithms, functors and lambda functions, how to increase the level of abstraction and simplify the code.

An important clarification: this lecture is not an attempt to grasp the immensity, but a short excursion into the useful features of C ++ for members of the Olympiad community: from extracting code into a class to the internal mechanisms of lambda functions and a pinch of constraints from C ++ 20. If interested, we invite you to view.

Detailed timecodes

00:53 – What you need to know before watching a lecture

02:00 – C ++ features

03:10 – Good sources of knowledge and practice in C ++

04:45Classes. Minimum stack

06:21 – Creating your own structure

09:03 – We prohibit direct access

09:53 – Making debugging easier

10:29Class templates

11:24 – Static polymorphism in different languages

12:03 – Optimization

12:27 – Compilation errors and instantiation

13:40 – Limitations (C ++ 20)

15:01Function templates

15:27 – Auto-output of parameters

16:21 – Class Template Argument Deduction (CTAD, C ++ 17)

16:56 – Compilation errors and instantiation

17:47 – Generalized programming

19:12 – Nested types

20:10 – Advanced techniques

20:33 Functors

21:00 – Functional objects

21:56 – As a template parameter

22:30 – State functors

23:26 – Stateful functors for containers

24:42Lambda expressions

25:38 – Decoding lambda

26:28 – Saving to a variable

27:27 – Recursion is not supported

27:56 – Captures by value and reference

29:18 – Capture with initializer

30:29 – Combined grippers

31:16 Using functors

32:15 – IIFE

33:18 – Vector lambdas and type erasure

34:36 – Functor as function parameter

35:51 – Functor as a class field

37:45 – More complex data structures (cartesian tree, cut tree)

38:34 Behind the scenes: lambdas comparators

39:48Behind the Scenes: More Complex Templates

41:23 – Student projects in C ++ (last year told about the projects of our freshmen)

If you have any questions, feel free to ask them in the comments or personally. Yegor

Similar Posts

Leave a Reply