File stuff.h

vector<pair<int, vector<pair<int, int>>>> v_hist_vars;
vector<pair<int, vector<pair<int, int>>>> h_hist_vars;
vector<pair<int, vector<pair<int, int>>>> d1_hist_vars;
vector<pair<int, vector<pair<int, int>>>> d2_hist_vars;

Compiler output

stuff.h:40: error: ISO C++ forbids declaration of vector with no type
stuff.h:40: error: expected ; before < token
stuff.h:41: error: ISO C++ forbids declaration of vector with no type
stuff.h:41: error: expected ; before < token
stuff.h:42: error: ISO C++ forbids declaration of vector with no type
stuff.h:42: error: expected ; before < token
stuff.h:43: error: ISO C++ forbids declaration of vector with no type
stuff.h:43: error: expected ; before < token

And so on. It should be std::vector... And (I actually don't know why) it is bad practice to put a using namespace yaddayadda; on a .h file. OK, whatever. It looks like it might cause namespace pollution, so don't spit on the face of your .h file users hiding a namespace usage thingie there. Second attempt.

std::vector<std::pair<int, std::vector<std::pair<int,int>>>> v_hist_vars;
std::vector<std::pair<int, std::vector<std::pair<int,int>>>> h_hist_vars;
std::vector<std::pair<int, std::vector<std::pair<int,int>>>> d1_hist_vars; 
std::vector<std::pair<int, std::vector<std::pair<int,int>>>> d2_hist_vars; 

Compiler output

stuff.h:40: error: >> should be > > within a nested template argument list
stuff.h:40: warning: >> operator will be treated as two right angle brackets in C++0x
stuff.h:40: warning: suggest parentheses around >> expression
stuff.h:40: error: v_hist_vars was not declared in this scope
stuff.h:40: error: >> should be > > within a nested template argument list

It is funny that the compiler understands what I'm telling to it, but it still doesn't let me use that syntax.

Well, no, it ain't funny at all. Third attempt.

std::vector<std::pair<int, std::vector<std::pair<int, int> > > > v_hist_vars;
std::vector<std::pair<int, std::vector<std::pair<int, int> > > > h_hist_vars;
std::vector<std::pair<int, std::vector<std::pair<int, int> > > > d1_hist_vars;
std::vector<std::pair<int, std::vector<std::pair<int, int> > > > d2_hist_vars;

It isn't obvious, but the declaration takes 77 chars. And that is inside a class, so add the indentation for the class body and for the access specifier (at least 4 more chars). And all I wanted was a tree-like structure, without (re)implementing memory allocation, new data structures, and so on. Silly rabbit.

On another file, I got the following compilation error:

stuff.cpp:161: error: cannot convert std::vector<std::pair<int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > >, std::allocator<std::pair<int, std::vector<std::pair<int, int>, std::allocator<std::pair<int, int> > > > > > to int in initialization

I know it is my fault, but do you really have to call my mother names to tell me so? Who on earth can read that?

C++ : The Perl of static-typed languages.

C++ : the PDP-11 assembler that thinks it's an object system

C++ : As verbose as Java, and no garbage collection.

Well, at least in C++ you can have dynamic arrays of ints, and you don't have to fall back to a hack this ugly. Hint: even it you give it a catchy name, it will still suck. Oh, thanks for generating the code I would be forced to write because the language wasn't properly designed. And that will cause performance to suck so much that even you admit it. Meh.