求助struct!!!
struct ME_Sample
{
public:
ME_Sample() :label("") {};//
ME_Sample(const std::string &l) : label(l) {};
void set_label(const std::string & l)
{
label = l;
}
// to add a binary feature
void add_feature(const std::string & f)
{
features.push_back(f);
}
// to add a real-valued feature
void add_feature(const std::string & s, const double d)
{
rvfeatures.push_back(std::pair<std::string, double>(s, d));
}
public:
std::string label;
std::vector<std::string> features;
std::vector<std::pair<std::string, double> > rvfeatures;
// obsolete
void add_feature(const std::pair<std::string, double> & f)
{
rvfeatures.push_back(f); // real-valued features
}
};
网上找的一个工具包,这段结构不太懂
ME_Sample() :label("") {};能给我解释下这个声明么?是使用结构体名声明的函数么?
ME_Sample(const std::string &l) : label(l) {};
还有这个。。
{
public:
ME_Sample() :label("") {};//
ME_Sample(const std::string &l) : label(l) {};
void set_label(const std::string & l)
{
label = l;
}
// to add a binary feature
void add_feature(const std::string & f)
{
features.push_back(f);
}
// to add a real-valued feature
void add_feature(const std::string & s, const double d)
{
rvfeatures.push_back(std::pair<std::string, double>(s, d));
}
public:
std::string label;
std::vector<std::string> features;
std::vector<std::pair<std::string, double> > rvfeatures;
// obsolete
void add_feature(const std::pair<std::string, double> & f)
{
rvfeatures.push_back(f); // real-valued features
}
};
网上找的一个工具包,这段结构不太懂
ME_Sample() :label("") {};能给我解释下这个声明么?是使用结构体名声明的函数么?
ME_Sample(const std::string &l) : label(l) {};
还有这个。。
...全文
相关推荐
c++笔记struct和typedef struct彻底明白了
c++笔记struct和typedef struct彻底明白了
struct和typedef struct区别
struct typedef struct 区别
typedef struct 与 struct 的区别及初始化
typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化 typedef struct 与 struct 的区别及初始化
C_C++中typedef_struct和struct的用法
C_C++中typedef_struct和struct的用法。
typedef_struct与struct之间的区别
本篇文章主要是对typedef struct与struct之间的区别进行了介绍,需要的朋友可以过来参考下,希望对大家有所帮助


