884 karma · joined July 20, 2014
Home: stl@nuwen.net
Work: stl@microsoft.com (I work for Microsoft, but I don't speak for them.)
EDIT: Specifically, questions about the C++ Core Language and Standard Library, which is what I work on all day; questions about other topics are welcome but other MS people will have to answer them, since I am mostly clueless about other areas.
(Template code bloat itself is nearly mythical. I've seen exactly one occurrence of it causing a problem, in 8 years of Standard Library maintenance.)
Therefore, "want speed? pass by value" can result in worse performance. Overloading for copy/move is near-optimal and perfect forwarding is optimal - this is what the STL does (push_back is copy/move overloaded, emplace_back perfectly forwards).
Users must be able to include <iterator> by itself, and get istream_iterator.
We do break things up into internal headers, we just haven't done that as much as possible. Come to think of it, equal() is defined in one of our central headers, so we should probably take advantage of that in <array>.
But yeah, it drags in a whole tree of headers. Minimizing this is possible, and we've taken steps to do so in the past, but it's a lot of work for possibly minimal benefit - user translation units tend to drag in many STL headers, especially if they're using precompiled headers like they should. We think our time is better spent fixing correctness bugs and implementing features.
One of the major differences between shared_ptr and CComPtr is that shared_ptr is non-intrusive - it can manage anything, even things like ints that don't know anything about strong/weak refcounts.
"meow" is a traditional string literal, whose type is const char [5] (array of 5 const chars). When you say "auto", you get the same deduction as when you pass something to a template foo(T t) taking by value. This triggers "decay", where arrays decay to pointers. Hence auto (and T) is const char *.
"meow"s is a user-defined literal (the Standard Library is a user as far as the compiler is concerned), for which you must include <string> and say "using namespace std::string_literals;" or something equivalent. The specification for UDLs says that this calls operator""s() which returns a std::string by value.
Yep, I'm the video guy. Glad you like them!
Imagine that only the Earth and the International Space Station exist. The ISS is doomed because it has stopped orbiting, and is falling straight down. Inside the ISS, an astronaut has placed 5 marbles in the shape of a plus sign (center, left/right/up/down). For convenience, the "center" marble is also at the center of mass of the whole ISS. There's no air or anything to mess up the results. What happens to the marbles?
Look at the problem from the frame of the Earth. The Earth is exerting a certain force on the center marble, call it F. The "down" marble is slightly closer to the Earth, so it experiences a greater force, F + Something. The "up" marble is slightly further from the Earth, so it experiences a lesser force, F - Blah. The "left" and "right" marbles experience forces very very close to F (slightly less, if they're in a straight line, but much closer to F than F - Blah). However, those forces are directed towards the center of the Earth, so those vectors have small components directed towards the "center" marble.
Now that we've figured out the forces, look at the problem from the frame of the marbles. We're in free fall, so the "center" marble floats motionless. The "down" marble is going to float further away from the center marble (F + Something pulls "down" harder), and the "up" marble will also float further away from the center marble (F - Blah pulls "up" less than everything else). The "left" and "right" marbles float towards the center.
Using only Newton's laws, this reveals that gravity's behavior over a volume has a stretching effect in the up-down direction, and a squeezing effect in the left-right direction. GR confirms this. This effect is the tidal force.
When applied to the Earth and the Moon, this explains the two bulges. The bulge closer to the Moon is due to F + Something, because that water is being pulled stronger. The bulge away from the Moon is due to F - Blah, because that water is being pulled less than everything else.
You're probably thinking of things like atomic increments, which are one to two orders of magnitude more expensive than an ordinary increment.
This is also why C++14's dual-range algorithms didn't lead to ambiguities: equal(InIt1, InIt1, InIt2, Pred) versus equal(InIt1, InIt1, InIt2, InIt2) has the same structure.
(Obviously if you have a type that is both a range and a predicate, then it's ambiguous.)
How do you think my title differs from the contents? As far as I can tell, it is completely accurate.
My slides are already at the upper limit for information density - I don't think I could cram even more into them.