Re:The visitor pattern is essentially the same thing as Chur...
by scatters on Thursday February 04, 2021 @07:30AM
(#26024784)
Here's the first example in C++:
Of course, this is missing type-erasure, which you'd need to pass `Shape` across TU boundaries, but that's unnecessary if you're happy to use parametric polymorphism.
[ Parent
| on HN ]
Re:The visitor pattern is essentially the same thing as Chur...
by pjmlp on Thursday February 04, 2021 @07:58AM
(#26024939)
Which could be done with a little help from std::any, just as info for others.
Re:The visitor pattern is essentially the same thing as Chur...
by matheusmoreira on Thursday February 04, 2021 @02:46PM
(#26029011)
Whoa! C++ has become an almost completely different language since I learned it over 10 years ago...
Re:The visitor pattern is essentially the same thing as Chur...
by jfengel on Thursday February 04, 2021 @04:17PM
(#26029908)
That was precisely what I was going to say. I don't recognize any of that.
Re:The visitor pattern is essentially the same thing as Chur...
by matheusmoreira on Thursday February 04, 2021 @07:03PM
(#26031283)
Yeah, I recognize the lambda expressions and not much else. How does the new stuff even interact with the older features? I can't even tell if something is recommended or deprecated anymore. Can you imagine the sheer work of maintaining a compiler for this thing? Really makes me appreciate the relative simplicity of C.
On a positive note, it looks like the standard library became amazing. It seems really well designed. Contains things that used to be preprocessor definitions, lots of very popular functionality, good symbol names and no cryptic abbreviations anywhere. Did it absorb some of boost?
Re:The visitor pattern is essentially the same thing as Chur...
by AnimalMuppet on Thursday February 04, 2021 @06:22PM
(#26030979)
I, uh, recognized "#include", but not much else...
Re:The visitor pattern is essentially the same thing as Chur...
by scatters on Friday February 05, 2021 @06:52AM
(#26035337)
That'll be gone soon: https://en.cppreference.com/w/cpp/language/modules