In standard library, I found that namespace std
is declared as a macro.
#define _STD_BEGIN namespace std {
#define _STD_END }
Microsoft Visual Studio 9.0\VC\include\yvals.h
. But I couldn't find the STL files including this. If it is not included, how it can be used?Any thoughts..?
Probably not a best practice as it can be difficult to read compared to a vanilla namespace
declaration. That said, remember rules don't always apply universally, and I'm sure there is some scenario where a macro might clean things up considerably.
"But I couldn't find the STL files including this. If it is not included, how it can be used?".
All files that use this macro include yvals.h
somehow. For example <vector>
includes <memory>
, which includes <iterator>
, which includes <xutility>
, which includes <climits>
, which includes <yvals.h>
. The chain may be deep, but it does include it it some point.
And I want to clarify, this only applies to this particular implementation of the standard library; this is in no way standardized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With