[try Beta version]
Not logged in

 
>1 namespaces?

May 8, 2013 at 3:13pm
What does it mean to use two namespaces at the same time? For instance, if I use

1
2
  using namespace cv;
  using namespace std;


how does the compiler resolve conflicts between function names in these namespaces?
May 8, 2013 at 3:17pm
It doesn't; if you use an unqualified function name and there are matching functions in both namespaces, compilation will stop.
May 8, 2013 at 3:19pm
Thanks? What's an unqualified function name? One that appears in both namespaces?
May 8, 2013 at 3:25pm
unqualified is one that doesn't have a :: before it. endl() is unqualified, so it will be looked up in all namespaces you pulled in with using declarations.
std::endl() and ::std::endl() are qualified, so they will only be looked up in the std namespace
Last edited on May 8, 2013 at 3:26pm
Topic archived. No new replies allowed.