stl and namespaces

This is a discussion on stl and namespaces within the C++ Programming forums, part of the General Programming Boards category; In the past when using stl classes in my program I've just done a using namespace::std; to get it correctly. ...

  1. #1
    Unregistered
    Guest

    stl and namespaces

    In the past when using stl classes in my program I've just done a using namespace::std; to get it correctly. I've been doing some reading, and I guess this isn't a good practice.

    The following is an example of where I cannot figure out how to get stl to compile without a using namespace::std:

    Code:
    #include <list>
    using std::list;
    using std::iterator;
    
    int main()
    {
       list< list<char>* > lines_list;
       list< list<char>* >::iterator lines_itr = lines_list.begin();
    
       return 0;
    }
    The above code works if I throw in a using namespace::std;.

    It's not a major problem, but I would like to understand the proper way.

    Chad

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    305
    its "using namespace std;" and that is the correct way...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. namespaces
    By Ancient Dragon in forum C++ Programming
    Replies: 6
    Last Post: 09-30-2005, 07:04 PM

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