About namespace std

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • 322322

    About namespace std

    Could anybody tell where is the namespace std file ? Thanks a lot !
    namespace::std{
    .....
    ....
    }
  • Nick Keighley

    #2
    Re: About namespace std

    On 27 Mar, 12:53, 322322 <714794...@qq.c omwrote:
    Could anybody tell where is the namespace std file ? Thanks a lot !
    namespace::std{
    since a namespace isn't a file there is no namespace std (abbreviated
    to std:: in this post) file. The things that are in std:: such as
    std::cout are defined in standard includes

    #include <iostream>

    these *may* be implemented as files. But the mapping
    is not defined by the language definition (possibilities
    are iostream and iostream.h).

    So since you can't have what you asked for, what do you really
    want? Do you want a list of all the names in std::? It will be
    huge! All I can suggest is google it.

    <pause>

    hmmm. maybe not such a good idea. Most hits seemed to be trying
    to answer questions like "Why does it hurt when I pee?"


    --
    Nick Keighley

    Comment

    • 322322

      #3
      Re: About namespace std



      Nick Keighley $B<LF;!'(B
      On 27 Mar, 12:53, 322322 <714794...@qq.c omwrote:
      >
      Could anybody tell where is the namespace std file ? Thanks a lot !
      namespace::std{
      >
      since a namespace isn't a file there is no namespace std (abbreviated
      to std:: in this post) file. The things that are in std:: such as
      std::cout are defined in standard includes
      >
      #include <iostream>
      >
      these *may* be implemented as files. But the mapping
      is not defined by the language definition (possibilities
      are iostream and iostream.h).
      >
      So since you can't have what you asked for, what do you really
      want? Do you want a list of all the names in std::? It will be
      huge! All I can suggest is google it.
      >
      <pause>
      >
      hmmm. maybe not such a good idea. Most hits seemed to be trying
      to answer questions like "Why does it hurt when I pee?"
      >
      >
      --
      Nick Keighley

      Why I can't find the "using namespace std "in <ios>,<iostream and
      <string???
      Thanks!

      Comment

      • Lionel B

        #4
        Re: About namespace std

        On Thu, 27 Mar 2008 06:36:36 -0700, Nick Keighley wrote:
        On 27 Mar, 12:53, 322322 <714794...@qq.c omwrote:
        >
        >Could anybody tell where is the namespace std file ? Thanks a lot !
        >namespace::std {
        [...]
        So since you can't have what you asked for, what do you really want? Do
        you want a list of all the names in std::? It will be huge! All I can
        suggest is google it.
        >
        <pause>
        >
        hmmm. maybe not such a good idea. Most hits seemed to be trying to
        answer questions like "Why does it hurt when I pee?"
        LOL!

        Try sticking a "C++" in front of that...

        --
        Lionel B

        Comment

        • Lionel B

          #5
          Re: About namespace std

          On Thu, 27 Mar 2008 07:21:29 -0700, 322322 wrote:
          Nick Keighley 写道:
          >On 27 Mar, 12:53, 322322 <714794...@qq.c omwrote:
          >>
          Could anybody tell where is the namespace std file ? Thanks a lot !
          namespace::std{
          >>
          >since a namespace isn't a file there is no namespace std (abbreviated
          >to std:: in this post) file. The things that are in std:: such as
          >std::cout are defined in standard includes
          >>
          >#include <iostream>
          >>
          >these *may* be implemented as files. But the mapping is not defined by
          >the language definition (possibilities are iostream and iostream.h).
          >>
          >So since you can't have what you asked for, what do you really want? Do
          >you want a list of all the names in std::? It will be huge! All I can
          >suggest is google it.
          [...]
          Why I can't find the "using namespace std "in <ios>,<iostream and
          <string???
          Why would you expect to find "using namespace std" in those headers? They
          don't "use" namespace std, they declare things *in* namespace std. E.g.
          if some function `void foo()' in namespace `joe' were declared in some
          header, you would expect to see:

          namespace joe
          {
          void foo();
          }

          in that header. I'd suggest reading about namespaces in a good C++ book.

          --
          Lionel B

          Comment

          Working...