I'm writing a chess program and I've defined the classes I've created under the chess namespace.
To shorten the code in files that use those classes, i preface it with using chess::Point, chess::Board, chess::Piece and so on.
Is there a way to specify that I'm bringing in scope multiple elements from the same namespaces like in Rust? (Such as use chess::{Point,Board,Piece})
CodePudding user response:
No. But you can bring them all at once, using:
using namespace chess;
// then use Point instead of chess::Point, Board instead of chess::Board, etc
CodePudding user response:
You could use namespace alias instead of bringing everything into the scope. Create a shorter alias for chess.
namespace ch = chess;
// ch::Point, ch::Board, ch::Piece // all are valid.
