4 ms·
Where's the template metaprogramming section? What about the double bracket operator? etc... Or, to put it another way: very nice website for basic exposure
by ur-whale 4y ago
Where's the template metaprogramming section?
What about the double bracket operator?
etc...
Or, to put it another way: very nice website for basic exposure but mostly demonstrates very basic stuff.
- jvanderbot 4y agoYeah, it's fairly basic, and most of this is in the usual c++ docs like cppreference.com But... Is template meta-programming a required feature of a C++ dev? double-bracket is ... an edge case of usual [] overloading, isn't it?
- ur-whale 4y agoThese are just examples to make a point. And: https://arne-mertz.de/2016/12/modern-c-features-attributes/ https://arne-mertz.de/2016/12/modern-c-features-attributes/
- stonemetal12 4y agoTemplates are a major feature of the language, leaving it out seems a little weird.
- d_tr 4y agoLooks like an ongoing work so more will probably be available in the future. I see an example for templates. Template metaprogramming is more advanced but would be nice to include.
- sva_ 4y agoThese? https://cppbyexample.com/templates.html https://cppbyexample.com/templates.html
- ur-whale 4y agoThat's just templates. I'm talking about stuff like this: https://en.wikipedia.org/wiki/Template_metaprogramming#Static_Table_Generation https://en.wikipedia.org/wiki/Template_metaprogramming#Stati...
- ncmncm 4y agoIt has been years since I was tempted to template metaprogramming. It is a specialist technique being made redundant by straightforward language features that compile much faster.
- jvanderbot 4y agoYeah. I've never seen this in practice except as premature optimization or solving a problem in code that can be solved easier elsewhere.
- donedealomg 4y ago
- sudosysgen 4y agoI don't see what special about double brackets? It's just calling the operator again on the result, completely intuitive.
- edflsafoiewq 4y agoHe means attributes, eg [[nodiscard]]. Of course you shouldn't call them operators.
- MauranKilom 4y agoSee, I assumed they meant the >> operator. That used to (long ago) be cause for grief in e.g. std::vector<std::vector<int>> where the parser would see a >> operator instead of two closing angle brackets (since fixed by changing the grammar).
- tialaramex 4y agoSo, there are four things which might get colloquially called "Brackets", they each have other names but... (Round) brackets are Parentheses {Curly} brackets are Braces <Angle> brackets are Chevrons [Square] brackets are often just Brackets Ah, so there's the problem. Now, this actually also differs depending on English variant. In England it would be pretty normal to say "Brackets" and mean Parentheses, whereas in the US you'd mean the square brackets. Some English speakers outside the US might call the Square Brackets "Crotchets" to distinguish them, not so many. US English dominates in technology.