remove using std from cpp
This commit is contained in:
@@ -24,15 +24,15 @@ class FeatMap {
|
||||
// function definitions
|
||||
/*! \brief load feature map from text format */
|
||||
inline void LoadText(const char *fname) {
|
||||
FILE *fi = utils::FopenCheck(fname, "r");
|
||||
std::FILE *fi = utils::FopenCheck(fname, "r");
|
||||
this->LoadText(fi);
|
||||
fclose(fi);
|
||||
std::fclose(fi);
|
||||
}
|
||||
/*! \brief load feature map from text format */
|
||||
inline void LoadText(FILE *fi) {
|
||||
inline void LoadText(std::FILE *fi) {
|
||||
int fid;
|
||||
char fname[1256], ftype[1256];
|
||||
while (fscanf(fi, "%d\t%[^\t]\t%s\n", &fid, fname, ftype) == 3) {
|
||||
while (std::fscanf(fi, "%d\t%[^\t]\t%s\n", &fid, fname, ftype) == 3) {
|
||||
this->PushBack(fid, fname, ftype);
|
||||
}
|
||||
}
|
||||
@@ -62,6 +62,7 @@ class FeatMap {
|
||||
|
||||
private:
|
||||
inline static Type GetType(const char *tname) {
|
||||
using namespace std;
|
||||
if (!strcmp("i", tname)) return kIndicator;
|
||||
if (!strcmp("q", tname)) return kQuantitive;
|
||||
if (!strcmp("int", tname)) return kInteger;
|
||||
|
||||
@@ -91,21 +91,21 @@ class IStream {
|
||||
/*! \brief implementation of file i/o stream */
|
||||
class FileStream : public IStream {
|
||||
private:
|
||||
FILE *fp;
|
||||
std::FILE *fp;
|
||||
public:
|
||||
explicit FileStream(FILE *fp) : fp(fp) {
|
||||
explicit FileStream(std::FILE *fp) : fp(fp) {
|
||||
}
|
||||
virtual size_t Read(void *ptr, size_t size) {
|
||||
return fread(ptr, size, 1, fp);
|
||||
return std::fread(ptr, size, 1, fp);
|
||||
}
|
||||
virtual void Write(const void *ptr, size_t size) {
|
||||
fwrite(ptr, size, 1, fp);
|
||||
std::fwrite(ptr, size, 1, fp);
|
||||
}
|
||||
inline void Seek(size_t pos) {
|
||||
fseek(fp, 0, SEEK_SET);
|
||||
std::fseek(fp, 0, SEEK_SET);
|
||||
}
|
||||
inline void Close(void) {
|
||||
fclose(fp);
|
||||
std::fclose(fp);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ inline double NextDouble(void) {
|
||||
}
|
||||
/*! \brief return a random number in n */
|
||||
inline uint32_t NextUInt32(uint32_t n) {
|
||||
return (uint32_t)floor(NextDouble() * n);
|
||||
return (uint32_t)std::floor(NextDouble() * n);
|
||||
}
|
||||
/*! \brief return x~N(mu,sigma^2) */
|
||||
inline double SampleNormal(double mu, double sigma) {
|
||||
|
||||
@@ -149,8 +149,8 @@ inline void Error(const char *fmt, ...) {
|
||||
#endif
|
||||
|
||||
/*! \brief replace fopen, report error when the file open fails */
|
||||
inline FILE *FopenCheck(const char *fname, const char *flag) {
|
||||
FILE *fp = fopen64(fname, flag);
|
||||
inline std::FILE *FopenCheck(const char *fname, const char *flag) {
|
||||
std::FILE *fp = fopen64(fname, flag);
|
||||
Check(fp != NULL, "can not open file \"%s\"\n", fname);
|
||||
return fp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user