which to prefix with std:: ??

This is a discussion on which to prefix with std:: ?? within the C++ Programming forums, part of the General Programming Boards category; i have read a lot about namespaces and i want to get the good habbit of using "std:: " everywhere ...

  1. #1
    ~Team work is the best!~ wakish's Avatar
    Join Date
    Sep 2005
    Posts
    85

    which to prefix with std:: ??

    i have read a lot about namespaces and i want to get the good habbit of using "std:: " everywhere in my codes instead of globally declaring "using namespace std; "

    BUT my problem (or confusion) is where and which one to prefix with the "std:: "

    i know that cin, cout, endl need that prefix. And which one else??

    can anyone clear this out please!


    Thnx for ur attention!

    Kind Regards,
    wakish

  2. #2
    Dae
    Dae is offline
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Anything from the C++ Standard, iostream, vectors, map, fstream, exceptions, etc.

    You already named the big ones, cout, cin, endl. Others include istream, ostream, getline.

    http://www.cplusplus.com/ref/iostream/index.html

    Anything in there, haha.

    I mean if you are trying to use a function, I'm assuming you know where its coming from, and if its coming from any header without a .h, its probably going to need an std::.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why std:: and not using namespace std?
    By swappo in forum C++ Programming
    Replies: 4
    Last Post: 07-03-2009, 04:10 PM
  2. std:: or namespace std
    By C-+ in forum C++ Programming
    Replies: 16
    Last Post: 12-04-2007, 12:30 PM
  3. Builder 5 v's bcc32.exe
    By sononix in forum C++ Programming
    Replies: 3
    Last Post: 08-17-2004, 11:17 AM
  4. need ; before using namespace std
    By wwfarch in forum C++ Programming
    Replies: 7
    Last Post: 05-11-2004, 11:42 PM
  5. Site tutorials
    By Aalmaron in forum C++ Programming
    Replies: 20
    Last Post: 01-06-2004, 02:38 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21