Let's say I want to use
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
But I don't want to use
using namespace std;
Is there something like this:
using std::{cout, cin, endl};
I've tried
using std::{cout, cin, endl};
Instead I got a syntax error.
CodePudding user response:
As of c 17, you can add multiple objects in using
separated by a comma.
using std::vector, std::cout, std::cin;
Previously it required a separate using
statement for each. See the using declaration . You do have to include the full path for each declaration.