Importing a name onto the current scope provides the following syntax:
#include <string>
#include <vector>
using std::string;
using std::vector;
or, alternatively:
using namespace std;
On one hand, you get selective (one at a time) control or an all-or-nothing. Consider a more complicated program (this is reality for many). Pick all of the following in one line or 10 lines:
#include <string>
#include <vector>
#include <tuple>
#include <utility>
#include <memory>
using std::string;
using std::vector;
using std::tuple;
using std::make_tuple;
using std::pair;
using std::make_pair;
using std::shared_ptr;
using std::make_shared;
using std::unique_ptr;
using std::make_unique;
You get the idea. That's a lot of fluff before you get to the crux of the program.
* * *
This proposal is for the following simplified syntax (two alternatives).
1. Allow the use of a comma to separate each imported name. This is just a simplified version that eliminates the multiple using statements, allowing to separate the imported names with a comma.
#include <string>
#include <vector>
#include <tuple>
using std::vector, std::string, std::tuple, std::make_tuple;
or using different namespaces:
#include <string>
#include <vector>
#include <tuple>
#include <telephony.hpp> // declares multiple types within a telephony namespace
using std::vector, std::string, std::tuple, std::make_tuple, telephony::provider, telephony::address;
2. Enclose the imported names in curly braces.
#include <vector>
#include <string>
#include <tuple>
#include <iostream>
#include <chrono>
#include <telephony.hpp> // declares multiple types within a telephony namespace
using std { vector, string, tuple, make_tuple, cout, endl };
using std::chrono { Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday };
using telephony { provider, address, terminal, connection, terminal_connection };
Comments are welcome.