STD 是什么意思

来源:互联网 发布:linux查看端口的命令 编辑:程序博客网 时间:2024/04/28 17:02

<!-- /* Font Definitions */ @font-face{font-family:宋体;panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-alt:SimSun;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;}@font-face{font-family:"/@宋体";panose-1:2 1 6 0 3 1 1 1 1 1;mso-font-charset:134;mso-generic-font-family:auto;mso-font-pitch:variable;mso-font-signature:3 135135232 16 0 262145 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal{mso-style-parent:"";margin:0cm;margin-bottom:.0001pt;text-align:justify;text-justify:inter-ideograph;mso-pagination:none;font-size:10.5pt;mso-bidi-font-size:12.0pt;font-family:"Times New Roman";mso-fareast-font-family:宋体;mso-font-kerning:1.0pt;} /* Page Definitions */ @page{mso-page-border-surround-header:no;mso-page-border-surround-footer:no;}@page Section1{size:595.3pt 841.9pt;margin:72.0pt 90.0pt 72.0pt 90.0pt;mso-header-margin:42.55pt;mso-footer-margin:49.6pt;mso-paper-source:0;layout-grid:15.6pt;}div.Section1{page:Section1;}-->

stdc++的标准命名空间,所有标准类库都包含在其中,头文件的标识符在其中定义。  
  using   namespace   std
就是告诉编译器使用标准命名空间std,程序中的所有标准类库都在std中找。

不用using  namespace   std就要写std::....  

using   namespace   std   省点事,但对所有包含此头文件的都有影响。

 

namespace   就是一个名字的空间。是为了避免名字冲突而使用的。在不同的空间里可以使用同一个名字而不会引起名字冲突。  
 
它的声明就像声明一个类一样。 
 
例:  
  namespace   A{  
      int   f(){……};  
      char   g(){……};  
      ……}  
 
在使用名字空间里函数的时候有几种方法:  
  1-
就像声明一个类的成员函数一样,只是类名换成了空间名   A::f();  
  2-
可以用using关键字   using   namespace  A;   这样以后的代码使用的就是名字空间A中的函数了。  

原创粉丝点击