zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Spring
    数据库架构
    Spring
    Spring
    Spring
    服务的有状态和无状态(转)
    Java基础
    Ubuntu
    Ubuntu
    Ubuntu
  • 原文地址:https://www.cnblogs.com/yinwei-space/p/9262899.html
Copyright © 2011-2022 走看看