[geeks] VC++ STL vector

Joshua D Boyd jdboyd at cs.millersville.edu
Wed Sep 25 15:02:30 CDT 2002


On Wed, Sep 25, 2002 at 02:22:41PM -0500, Jonathan C. Patschke wrote:

> > Alright, I do
> > #include <vector>
> > in a program in VC++.
> >
> > vector <int> i;
> 
> ITYM std::vector, unless you have "using namespace std;" near the top of
> the source or header file.

Yeah, an Intro to CS student point that out to me after I posted.  When
I had the intro courses, such things weren't coverd.  A mid level
covered name spaces, but not in any usefull way.  Like, they didn't
point at that I might need them to use the STL.  Basically they pointed
out the existed and demonstrated what the affect was on scoping, then
said we didn't really ever need them.  Frankly, somedays I fear for my
employability after I graduate.  If I hdn't been being overly ambitious
now, I probably would have known such a thing when I was being interview
for a jobs.  I still couldn't say how to use the for a usefull benefit.
I am so screwed.  McDonalds here I come I guess.

> #ifdef __GNUC__
> #  if (__GNUC__ < 3)
>     /* We don't need namespace std */
> #  else
>     using namespace std;
> #  endif
> #else
>   using namespace std;
> #endif

Looks good to me.  I'll try it tonight.
 
-- 
Joshua D. Boyd



More information about the geeks mailing list