5 ms·
You can alias that type into a simpler name and keep using that instead of bringing components into the current namespace (or the global one). I haven't done C+
by bloodorange 6y ago
You can alias that type into a simpler name and keep using that instead of bringing components into the current namespace (or the global one). I haven't done C++ in some years but this was definitely a part of C++11.
- leetcrew 6y agoin practice I would probably do something more like this: typedef std::pair<std::string, std::string> TStringPair; std::vector<TStringPair> vec; or maybe: typedef std::vector<std::pair<std::string, std::string>> TStringPairVec; TStringPairVec vec; this improves readability a bit, but is even more verbose at the declaration site if I'm not reusing the typedefs elsewhere. in an ideal world, I'd like something analogous to #undef for `using namespace` (or better yet, have this be the default at the end of a header file). this is only scratching the surface of the gotchas that come from textual inclusion.