Hacker News new | ask | show | jobs
by xmonkee 1009 days ago
>but generally C++ programmers prefer to be explicit and include the namespaces.

why, though? Collisions in the stdlib? stdlib is too new to not be the default for these names?

1 comments

The using declaration modifies your namespace.

From the docs:

    namespace X
    {
        using ::f;        // global f is now visible as ::X::f
        using A::g;       // A::g is now visible as ::X::g
    }
 
    void h()
    {
        X::f(); // calls ::f
        X::g(); // calls A::g
    }
Link to docs: https://en.cppreference.com/w/cpp/language/namespace#Using-d...
Thanks