C++ using keyword

后端 未结 4 1265
醉话见心
醉话见心 2021-02-12 22:27

What is the difference between these two usage of using keyword:

using boost::shared_ptr;

and

using namespace boo         


        
4条回答
  •  面向向阳花
    2021-02-12 23:07

    The first is called using declaration;

    The second is called using directive.

    Quoting MSDN:

    Note the difference between the using directive and the using declaration:

    the using declaration allows an individual name to be used without qualification,

    the using directive allows all the names in a namespace to be used without qualification.

提交回复
热议问题