求助struct!!!
wo0dy 2010-03-13 10:38:39 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) {};
还有这个。。