Re: vectors

ML <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
Hi Clark,

Thanks for the reply.

>> I have code that uses a standard vector.

>> I get errors that say: ISO forbids declarations of vector with no type.

> That's probably because CW8 did the (non-standard/pre-standard) trick
> of putting everything in the global namespace. vector is in the std
> namespace and as such you'll need to do one of the following:
> 
> 1) Add "using namespace std;" to your file in order to bring in the
> whole std namespace
> 2) Add "using std::vector" in order to just bring in vector
> 3) Use the fully qualified "std::vector" wherever you currently use "vector"
> 
> Personally, #2 is the option that I usually go for (i.e. just pull in
> the symbols that I use).



OK, so I like #2 better, what if I was using vector and list?

Can I do something like: "using std::vector::list"

Or can I just do this when I actually declare and use the vector each time:
"using std::vector <type> vector_name"

-Jason
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.