3 ms·
I said C++ was diff, but how about: using namespace std; typedef vector<unordered_map<string, pair<string, string>> foo_bar_xref; foo_bar_xref foo( vect
by StillBored 4y ago
I said C++ was diff, but how about:
using namespace std;
typedef vector<unordered_map<string, pair<string, string>> foo_bar_xref;
foo_bar_xref foo( vector<vector<int>> x, unordered_map<string, string> y);
not sprinkling std:: everywhere helps with readability, but so does defining a couple types used frequently, especially if they are particularly verbose. And of course the parser doesn't really have a problem with this, so your editor should be able to find it with its 'goto declaration' function. I don't feel pity for people who chose to use editors/IDEs that make this difficult.
- xigoi 4y ago> not sprinkling std:: everywhere helps with readability I agree, but most C++ programmers don't :/ > And of course the parser doesn't really have a problem with this, so your editor should be able to find it with its 'goto declaration' function. C++ syntax is Turing-complete, so due to the halting problem, finding the declaration can take a long time, potentially unlimited in pathological cases.
- int0x80 4y ago>C++ syntax is Turing-complete, so due to the halting problem, finding the declaration can take a long time, potentially unlimited in pathological cases. Absolutely not unlimited time. Once it's parsed and semantically analyzed you can find the declaration in no time. Exactly like the compiler does. edit: to clarify, I was not taking into account unbounded recursion on template instantiation, which should be limited in any case by the compiler.
- int_19h 4y agoThe problem historically is that "using namespace" was undesirable in headers, since it would apply to anything that included them. And with the tendency for modern idiomatic C++ to be heavily templated, many function bodies have to be in the headers.
- mauvia 4y agoYou can use using = instead of typedef using namespace std; using foo_bar_xref = vector<unordered_map<string, pair<string, string>>; foo_bar_xref foo( vector<vector<int>> x, unordered_map<string, string> y);