rt.
我写了一个浮点数高精度的代码,然后编译错误,具体是什么编译错误下面会贴。
Code:
#include <iostream>
#include <algorithm>
#include <vector>
namespace Float {
const std::string symbol = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
template <size_t kMaxLength, int base = 10, class T = int> class BigFlt {
private:
size_t num_sz, flt_sz /* 问题出在 flt_sz 上 */;
T num[kMaxLength];
T flt[kMaxLength];
bool isFlt, f;
public:
/*
一些运算
*/
};
};
/*
错误:
C:/Program Files (x86)/Dev-Cpp/MinGW64/include/bigIntFloat.hpp: In function 'std::istream& Float::operator>>(std::istream&, Float::BigFlt<kMaxLength, base, T>&)':
C:/Program Files (x86)/Dev-Cpp/MinGW64/include/bigIntFloat.hpp:9:18: error: invalid use of non-static data member 'Float::BigFlt<kMaxLength, base, T>::flt_sz'
size_t num_sz, flt_sz;
^
*/
这是一个很(不能发出来)的语法错误,但是我不知道怎么改。已经试过了前面加 static,但是 ld return 1 了