the using keyword has many more uses. it can be used in a function scope rather than globally. it can be used to bring only the things you need to a scope rather than the whole namespace.
void fn() {
using std::cout;
cout << "Hi!\n";
}
Output
Hi!
void fn() {
using v = std::ranges::views;
using fmt::format;
using std::vector;
vector vec{1, 2, 3, 4, 5};
format(std::cout, "{}\n", vec | v::reverse);
}
Output
{5, 4, 3, 2, 1}
when i write your second code on visual studio ,i get error in (ranges:: and format::) what's wrong ? i use GNU g++17
°Moohaamed°
Anonymous
Hanz
Suka
Alieya MIN
Ludovic 'Archivist'
HaiNahi
Mar!o