Re:C++17 Filesystem – Writing a simple file watcher
by Topgamer7 on Monday January 14, 2019 @03:54PM
(#18906367)
Those files have so many "std::" references. Would this not be a good case to utilize "using namespace std"?
[ Parent
| on HN ]
Re:C++17 Filesystem – Writing a simple file watcher
by favorited on Monday January 14, 2019 @04:11PM
(#18906514)
It's a header-only class[0], and "using namespace" in headers is discouraged.
[0] https://github.com/sol-prog/cpp17-filewatcher/blob/master/Fi...
Re:C++17 Filesystem – Writing a simple file watcher
by Someone on Monday January 14, 2019 @05:46PM
(#18907276)
But one could use it scoped to the FileWatcher class or to each member function, or is my C++ too rusty?
Re:C++17 Filesystem – Writing a simple file watcher
by jhalstead on Monday January 14, 2019 @11:55PM
(#18908941)
I think it's too rusty, unless I'm misunderstanding https://abseil.io/tips/153. It says,
The vast majority of C++ users think that the using-directive is injecting names into the scope where it’s declared. ... In reality, the names are injected into the nearest common ancestor of the target namespace (::testing) and the usage namespace (::totw::example::anomymous). In our example, that’s the global namespace!