for (const auto &[x, y]: zip(a, subrange(begin(b), unreachable_sentinel))) {
/* Do something with x and y */
}
I'm not sure why C++ programmers don't like using `using`, it's as if Java programmers insist on typing out java.util.ArrayList every time because you may have an ArrayList of your own in the future.So much C++ code can become readable by adding `using namespace std::something`.
Other languages like Java have imports scoped a to a single file, so this is not a problem.
It makes sense to use std::vector in a .h(pp) file, but in the .cpp you should be able to `using namespace std`, right?
Not if a lot of your code is in the form of templates. You have to put those in headers.
Some things take time when trying to avoid Python 2 / 3 scenarios.
Using in a cpp file => absolutely fine.
definitely not as soon as you want to do unity/jumbo builds (which are in my experience the n°1 thing to do to get fast CI builds)
Java avoids this somewhat because functions are always in a class, so there is a little bit of extra namespacing, even if you've imported the class.
import someclass.doThing;
Or maybe that's what you meant by somewhat :)
In a header it's generally advised to not add using namespaces.
However, I appreciate the grandparent comment including the namespaces in the example, so I can see exactly where things are coming from.
Seems hard to make it any shorter. Well, I guess you could remove "const" if you want.