4 ms·
Typically, you'd just `using namespace std` on top of you file. Afterwards calls to `format` have the exact same length as `printf`.
by f1refly 3y ago
Typically, you'd just `using namespace std` on top of you file. Afterwards calls to `format` have the exact same length as `printf`.
- nuancebydefault 3y agoI don't understand. I genuinely thought that using using namespace std is considered bad practice because of possible arising conflicts. Also you still need to write the word format (though you could alias it to one character, with same namespace conflict possibilities). Am i pedantic?
- Quekid5 3y agoThis is questionable advice. In header files 'using namespace' should never be used, in implementation files it opens up some weird edge cases. Instead, do using fmt = std::format and then use fmt(...) as the function call. ... at least that the current advice AIUI.
- gavinray 3y agoThis is not widely considered a good practice, please don't "using namespace std".
- emmelaich 3y agoI know it's not recommended but I use it for main(). And extensive formatting and/or output should be minimised outside main(), imho.