如何减少用户数据类型表示法?(typedef?)
How to reduce an user data type notation? (typedef?)
我将ttmath库用于C++
(大数字)。我使用2D阵列(矩阵)。例如:
#define FOR(i,a,b) for(int (i)=(a); i<(b) ; ++(i))
#define Big ttmath::Big<2, 2>
vector < vector < Big > > A(n);
FOR(i, 0, n)
A[i].resize(n);
其中A——一个平方矩阵NxN。但我只想要类型:
Matrix A(n);
FOR(i, 0, n)
A[i].resize(n)
我试着使用typedef:
typedef vector < vector < Big > > Matrix;
但它不会编译。
MS与2013:
error C2143: syntax error : missing ';' before '<'
(与typedef一致)。
整个"项目"。:)
去掉递归宏Big
,改为使用typedef
,类似于:
typedef ttmath::Big<2, 2> Big_type;
typedef std::vector<std::vector<Big_type> > Matrix_type;
Marix_type A(n);
FOR(i, 0, n)
A[i].resize(n)
相关文章:
- C++:TypeDef使用元组
- 表示"accepting anything for this template argument" C++概念的通配符
- 如何将ampl中的集合表示为c++中的向量
- std::is_base_of表示ctor编译错误
- 输入中的字符串数未知(以字母表示)
- 我可以信任表示整数的浮点或双精度来保持精度吗
- 有没有一种方法可以通过"typedef"为重新定义的基本类型定义特征和强制转换运算符
- c++模板来表示多项式
- 询问在设计我的手臂模拟器功能表示格式1
- CMakeLists.txt中的命名空间表示法
- 为什么在使用typedef时类推导指南会失败
- C++射线示踪剂ppm表示没有足够的数据来显示图像
- 如何计算Big-O表示法中的平均渐近运行时间
- 我应该如何表示我拥有的连续元素序列?
- 在C++中,使用带有 std::optional 参数的函数<T>来表示可选参数是否有意义?
- 尝试根据类中 typedef 的存在来专门化模板函数
- 在 std::无符号字符的向量处存储 int 的十六进制表示形式
- 表示类模板C++空类型
- 使用UML表示在C++模板类中定义的typedef
- 如何减少用户数据类型表示法?(typedef?)