Re: vectors

Clark Cox <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
On Tue, Dec 1, 2009 at 2:23 PM, ML <[email protected]> wrote:
> I have code that uses a standard vector.
>
> Historically I have done #include <vector>
>
> it seems to me now that I am in XCode this does not work? It has to be me, obviously.
>
> I get errors that say: ISO forbids declarations of vector with no type.
>
> The code works under CW 8 though..

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).

-- 
Clark S. Cox III
[email protected]
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.