Back To Basics: Overload Resolution - CppCon 2021

Back To Basics: Overload Resolution - CppCon 2021

CppCon

2 года назад

14,673 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@VoidloniXaarii
@VoidloniXaarii - 07.10.2023 04:55

Thanks a lot for this great talk

Ответить
@VoidloniXaarii
@VoidloniXaarii - 12.09.2023 16:21

One of the best cppcons imho, thank u 4 posting this

Ответить
@dennydaydreamer
@dennydaydreamer - 22.12.2022 19:01

Great talk! So much to learn, not just from the topics covered but also the clarity in delivery. Just like to chime in for slide 13: isn't top-level const also not considered in overload resolution? (Although this is touched on by a question from the audience later on)

Ответить
@ultradude5410
@ultradude5410 - 03.07.2022 20:48

As soon as you see these two, you just know you’re going to get a very clear, very well-paced, very well-planned, and very thorough explanation of whatever the talk is about.

Always fantastic talks from these two.

Ответить
@konstantinburlachenko2843
@konstantinburlachenko2843 - 29.05.2022 22:25

It is an excellent talk. However I have used C++ maybe for 16 years totally and the following rules was enough for me:

A. Function overload precedence
1. An exact fitting, or a trivial conversion (array name in a pointer, function name in a function pointer, type T to const T).
2. Integral types promotion of numeric numbers (char int, float in double)
3. Traditional conversions (int to double, double to int), pointers to derivatives to pointers to base classes. Pointers to arbitrarily types to void pointes.
4. Conversions achieved with transformations specified by user code
5. Conversions due due to ellipsis ... (c style varargs)

If at the same level, two options are possible then call is considered controversial and rejected with compiler error.

B. Template function overloading searches for a set of suitable specializations according to steps below

1. All specializations that can be potentially called are searched
2. If any specialization is the more specialized of the two, then the less specialized is discarded.
3. Overloading set is functions from step 1-2 and regular functions from (A)
4. Regular function is considered as more prevalent if both template and non-template function considered as a good candidate
If the function passed 1-4 is not found, the call is incorrect and lead to ambiguity.


C. Binary operator overload resolution rules x@y. Where x is of type X and y is of type Y

1. If X is a class. Find out whether operator@ is a member of class X or base to class X
2. Try find operator operator@ in context of x@y
3. If X is namespace N, search for operator in namespace N
4. If Y is namespace M, search for operator in namespace M

That all information wa enough for me for all my experience. I have learned about after I have read - The C ++ Programming Language Special Edition, B.Stroustrup

Ответить
@yanushkowalsky1402
@yanushkowalsky1402 - 06.03.2022 21:42

damn that's enough of c++ for me today

Ответить
@Radioguy00
@Radioguy00 - 26.12.2021 23:00

As it is usual for this team, here is another clear and perfect presentation.

Ответить
@sanjaygatne1424
@sanjaygatne1424 - 24.12.2021 16:55

nice talk. Overload resolution is mind bending quiz. no one can answer exact answer, its in the hands of compiler, even if you read C++ std. many... times.

Ответить
@SamWhitlock
@SamWhitlock - 24.12.2021 08:37

I hope they fix Ansel's audio because this video is gonna really stand the test of time. Superb and useful, and explained in a way that anyone at pretty much any skill level can understand it!

Ответить
@VickyGYT
@VickyGYT - 24.12.2021 03:44

Who’s life would be better if c++ authors knew how to keep a language clean and easy to read and write? ….. everyonessss

Ответить
@aniliitb10
@aniliitb10 - 21.12.2021 22:55

Wow! thanks for the talk! Never thought an hour long video on overload resolution can be this interesting! I had found some of these examples online but never had a good understanding of rankings! I was already a huge fan of Ansel and Barbara's videos on their channel, impressive stuff again!

Ответить
@horaceandpete7129
@horaceandpete7129 - 21.12.2021 07:24

Great Talk!Thank you

Ответить