template<class T>
struct broker
{
typedef T typeBroker;
static std::vector<std::string> extractListBroker(const std::string& broker)
{
std::vector<std::string> vec;
if(broker.empty())
{
for(int i=0;i<typeBroker::nbBroker;++i)
vec.push_back(typeBroker::listBroker[i]);
}
else
{
typedef boost::tokenizer<boost::char_separator<char> > my_tok;
boost::char_separator<char> sep(";");
my_tok tok(broker, sep);
for (my_tok::const_iterator i = tok.begin(); i != tok.end(); ++i)
vec.push_back(*i);
}
return vec;
}
std::string brokerToStr(typename typeBroker::BROKER i) //<--Problem here !!
{
return typeBroker::listBroker[i];
}
};
struct brokerDisTradable : broker<brokerDisTradable>{
std::vector<std::string> listBroker;
brokerDisTradable()
{
listBroker.push_back("BRIDGE1");
listBroker.push_back("BRIDGELONDON");
listBroker.push_back("RECY");
listBroker.push_back("CURRENEX");
}
static const int nbBroker = 2;
enum BROKER { BRIDGE1, BRIDGELONDON, RECY, CURRENEX };
};
errro:错误C2039: 'BROKER':不是broker_def的成员:: brokerDisTradable”C++错误枚举和CRTP
任何想法?
谢谢!
一个小窍门:不要让非 - 如果你想让人们理解你认为你的代码在做什么,你可以在粘贴代码中使用英语评论。 –
什么是'broker_def' ? –
broker_def是一个命名空间对不起 – Guillaume07