Discussion:
Watcom C++ does not allow nested vectors?
(too old to reply)
Lynn McGuire
2014-12-05 02:36:05 UTC
Permalink
I had to put a #ifndef around some common code between my Visual Studio app and my Watcom C++ app. Does Watcom C++ not support
nested vectors?

#ifndef __WATCOMC__
// Watcom C++ has a big problem with nested vectors
std::vector <std::vector <std::string>> data;
#endif


Thanks,
Lynn
Peter Chapin
2014-12-05 03:49:19 UTC
Permalink
Post by Lynn McGuire
I had to put a #ifndef around some common code between my Visual Studio
app and my Watcom C++ app. Does Watcom C++ not support nested vectors?
#ifndef __WATCOMC__
// Watcom C++ has a big problem with nested vectors
std::vector <std::vector <std::string>> data;
#endif
You need to write that with a space inside the ">>". Otherwise ">>" looks
like a shift operator.

std::vector < std::vector<std::string> > data;

This is standard C++ 98. The new standard requires compilers to work it
out without the space. I actually think Open Watcom might implement this
if you turn on the c++0x support (such as it is).

Peter
Lynn McGuire
2014-12-05 18:49:16 UTC
Permalink
Post by Lynn McGuire
I had to put a #ifndef around some common code between my Visual Studio app and my Watcom C++ app. Does Watcom C++ not support
nested vectors?
#ifndef __WATCOMC__
// Watcom C++ has a big problem with nested vectors
std::vector <std::vector <std::string>> data;
#endif
You need to write that with a space inside the ">>". Otherwise ">>" looks like a shift operator.
std::vector < std::vector<std::string> > data;
This is standard C++ 98. The new standard requires compilers to work it out without the space. I actually think Open Watcom might
implement this if you turn on the c++0x support (such as it is).
Peter
Thanks!

Lynn

Loading...