Thread: stl and namespaces

  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, 06:04 PM