求助struct!!!

wo0dy wo0dy 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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) {};
还有这个。。
...全文
评论 6
收藏 已收藏
分享
返回顶部
wo0dy
C++ 语言 65,214 成员 250,514 内容