C++ Vector of vectors

后端 未结 5 759
不思量自难忘°
不思量自难忘° 2021-02-06 01:56

I have a class header file called Grid.h that contains the following 2 private data object:

vector column;
vector> row;
         


        
5条回答
  •  生来不讨喜
    2021-02-06 02:56

    This is probably not the index problem, but you also need a space between the nested angle brackets in your vector of vectors type declaration. C++ compilers have a hard time telling the difference between nested template types and the right bit shift operator.

    Example:

    vector >  vec2d;        // Good.
    
    vector>   anotherVec2d; // Bad!
    
    vector< vector > yetAgain;     // Best IMHO. 
                                        // Keeps the white space balanced.
    

提交回复
热议问题