CppCon 2018: Walter E. Brown “C++ Function Templates: How Do They Really Work?”

  Рет қаралды 23,394

CppCon

CppCon

Күн бұрын

Пікірлер: 25
@rdwells
@rdwells 6 жыл бұрын
When I previewed this and saw it was slides with lots of text, I thought "Oh, no, another talk where someone is just going to read slides to us", and expected to move on to something else after about 5 minutes. I'm glad I didn't. If you watch nothing else, watch the sections that cover slides 20 through 22. I've been using C++ since the mid 90s, and I've never seen what he talks about there presented better than he does.
@mwont
@mwont 6 жыл бұрын
Very clear and informative talk. Thank you.
@anhkhoa91280
@anhkhoa91280 5 жыл бұрын
You saved my day trying to understand Explicit Specialisation. Much respect to you!!!
@Bolpat
@Bolpat 2 жыл бұрын
44:22 I’m not saying everything about C++ is perfectly named, but STL stands for _standard template library,_ so no surprise there’s a lot of templates in it.
@Bolpat
@Bolpat 2 жыл бұрын
49:30 - 51:30 The abbreviated function templates and the constraints - including the adjective syntax - are in C++20. ❤
@KarelDonk
@KarelDonk 6 жыл бұрын
Coffee, fruit cake, and a walter brown video.
@Radioguy00
@Radioguy00 6 жыл бұрын
As usual, yet another very clear presentation from Walter
@kronek9371
@kronek9371 3 жыл бұрын
Excellent talk. One question from me, could anyone explain what "name" refer to in "Specialization of a template does not introduce a name"?
@jonathanwatmough
@jonathanwatmough 5 жыл бұрын
An excellent talk! I learned so much from this. Thanks Walter!
@Bolpat
@Bolpat 2 жыл бұрын
48:50 It does not seem like std::swap finds another swap in C++20/23, but std::range::swap does. So, use the latter or do the 2-step dance.
@meepk633
@meepk633 2 жыл бұрын
I want to have, T someFunction (T t) { } become std::string someFunction(std::string t) { } when called with a string literal like someFunction("somestring") How would I do that? Type traits? Overloaded proxy w/ explicit cast? What's the idiomatic way?
@jjvh
@jjvh 6 жыл бұрын
slide 22: Is it possible to create specialization (b) of (a) after the declaration of (c) or will it always become specialization (d) ?
@valbogda5512
@valbogda5512 5 жыл бұрын
Someone asks this question at the end. I'd say try it.
@misana77
@misana77 4 жыл бұрын
Yes: godbolt.org/z/5hrhh8
@Bolpat
@Bolpat 2 жыл бұрын
After template void f(T) { .. } // A template void f(T*) { .. } // B you can specialize both by explicitly providing template arguments. If you want an explicit specialization that takes int*: template void f(int*) { .. } // special A, explicit type arg required template void f(int*) { .. } // special B, version with explicit type arg template void f(int*) { .. } // spacial B, version without explicit type arg
@ARTijOMS
@ARTijOMS 6 жыл бұрын
-- "Function templates are special functions ..." Conceptually, they can be seen as functions (in a mathematical sense) that take types as arguments and spit out a function (in a C++ sense).
@CiprianNedisan
@CiprianNedisan 6 жыл бұрын
Exactly, templates are like mathematical mappings (functions), which take arguments and map to functions.
@renning22
@renning22 6 жыл бұрын
Exaxtly, they are functions input types output plain c++ functions, computed by compiler.
@valbogda5512
@valbogda5512 5 жыл бұрын
Exactly #3, I'm surprised that none called him on that. Templates clearly map some things to some other things. His implied argument against it is that we can't call them, yet we can definitely observe them :). To give him the benefit of a doubt, he might have wanted to mean that thinking of them as "functions" is unhelpful. But to state that they are notany kind of function is blatantly wrong. Furthermore, without having the context of the quotes he presented we can't be sure whether they were used wrong or not.
@alexo989
@alexo989 2 жыл бұрын
and this is the problem with academic types - function template does not have to be visible in "its entirety" , that is why in c++ we have linker , forward declaration /specialization is perfectly acceptable in c++ ( it is not java , the gentleman is probably confused about that )
@DanielHsHu
@DanielHsHu 2 жыл бұрын
Why the hell do i need to invest space in my brain to hold those rules? Just dont write code in such a way. A code should be cleanly understandable with minimal amount of knowledge and mental work. Inserting artificial rules to solve artificial problems, and expecting people to remember those rules is innefficient.
@fwang3695
@fwang3695 Жыл бұрын
I feel bad for all those compiler developers that have to put up with all these non senses
@__hannibaalbarca__
@__hannibaalbarca__ Жыл бұрын
No no… ; This because our Mathematical level goes down and down; And other thing that all compiler designers were Mathematicians first before CS; and As Mathematician I like and i work to put thing more general and universal of use and make C++ very close and close to maths Axiomatic.
CppCon 2018: Jason Turner “Applied Best Practices”
1:03:19
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 906 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 17 МЛН
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 52 МЛН
CppCon 2018: Jason Turner “Surprises in Object Lifetime”
1:01:28
A Medley of C++ - Walter E Brown - C++ on Sea 2022
1:32:21
cpponsea
Рет қаралды 1,9 М.
The Return of Procedural Programming - Richard Feldman
52:53
ChariotSolutions
Рет қаралды 48 М.
Why Can't We Make Simple Software? - Peter van Hardenberg
41:34
Handmade Cities
Рет қаралды 157 М.