C++: typedef与template的配合使用;

利用STL的vector能够实现多维矩阵,但是写起来不怎么好看,使用typedef定位为

固定的格式:

//多维矩形,vector实现;
template<class T>
class      iQsVec
{
public:
    typedef         std::vector<T>         dim1;              //一维;
    typedef         std::vector<std::vector<T>>         dim2;     //二维;
    typedef         std::vector<std::vector<std::vector<T>>>         dim3;     //三维;
    typedef         std::vector<std::vector<std::vector<std::vector<T>>>>       dim4;     //四维;
};

对应即为:

iQsVec<float>::dim3

原文地址:https://www.cnblogs.com/yinwei-space/p/9262899.html