Generic vector of vectors in C++

You want to have template-typedefs. That is not yet supported in the current C++. A workaround is to do

template<typename T>
struct vecvec {
     typedef std::vector< std::vector<T> > type;
};

int main() {
    vecvec<int>::type intSequences;
    vecvec<std::string>::type stringSequences;
}

In the next C++ (called c++0x, c++1x due to 2010), this would be possible:

template<typename T>
using vecvec = std::vector< std::vector<T> >;

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)