Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to put the using declaration

Tags:

c++

What's the recommended practice regarding the using declaration (e.g using std::vector;)?

Should it be at the top of the cpp/cc file or just in the scope where it's being used?

like image 456
MikMik Avatar asked Oct 10 '22 00:10

MikMik


1 Answers

Limiting its scope would be better in general, but it would take a non-trivial amount of code in your source file to make a difference in practice.

like image 159
Jon Avatar answered Oct 13 '22 10:10

Jon