by codeflo · 4y ago · 0 comments
(Personally, I don’t think typing unique_ptr<Foo> or unique_ptr<const Foo> is such a big deal. But then, I also consider having “using namespace std” the only somewhat sane way to use the STL.)
I hope you never ever do that in a header :)
let sandwiches = inventory.filter(delicious_cheeses).map(make_sandwich).collect();
... won't compile because Rust can't infer what sort of container sandwiches is. Is it a vector? A list? Something custom?When C++ can't be sure in some places auto is obligatory anyway, so, too bad, you get what you're given. There are rules for what you get, but you might have reasonably intended something else, and so the effect is surprising.