地图上的模板参数无效std :: map< std :: string,Stock *> &股票 [英] Invalid template arguments on map std::map< std::string, Stock*> &stocks
本文介绍了地图上的模板参数无效std :: map< std :: string,Stock *> &股票的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有声明(或类似的)
std::map< std::string, Stock*> &stocks;
Eclipse不喜欢这样,并产生一个模板参数无效错误。
throughout my code. Eclipse does not like this and produces a "Invalid template arguments" error.
股票被声明为:
class Stock {
public:
Stock(std::string, qbbo::Financial_status_indicator, qbbo::Security_class,
qbbo::Current_trading_state,
qbbo::Market_category, qbbo::Reg_sho_action);
~Stock();
void setFinancialStatusIndicator(qbbo::Financial_status_indicator financialStatusIndicator);
void setSecurityClass(qbbo::Security_class securityClass);
void setCurrentTradingState(qbbo::Current_trading_state tradingState);
void setMarketCategory(qbbo::Market_category marketCategory);
void setREGShoAction(qbbo::Reg_sho_action regSHOAction);
bool isStockTrading();
private:
enum StockState {
STOCK_STATE_OK, STOCK_STATE_UNKNOWN, STOCK_STATE_UNEXPECTED_CHARACTERISTIC
};
std::string name;
int inventory;
StockState currentState;
// Expected values initialised in constructor
qbbo::Financial_status_indicator expectedFinancialStatusIndicator;
qbbo::Security_class expectedSecurityClass;
qbbo::Current_trading_state expectedCurrentTradingState;
qbbo::Market_category expectedMarketCategory;
qbbo::Reg_sho_action expectedRegSHOAction;
// Actual values as set by messages
qbbo::Financial_status_indicator financialStatusIndicator;
qbbo::Security_class securityClass;
qbbo::Current_trading_state currentTradingState;
qbbo::Market_category marketCategory;
qbbo::Reg_sho_action regSHOAction;
void nextState();
};
我看不到什么是无效的声明,它编译良好。有没有什么我缺少,Eclipse正在捕捉?
I cannot see whats invalid about this declaration and it compiles fine. Is there something I'm missing and Eclipse is catching?
短自己包含的正确例子
#include <string>
#include <map>
#include "stock.h"
int main() {
std::map<std::string, Stock*> stocks;
}
推荐答案
错误。创建新项目并重新执行步骤 Eclipse CDT C ++ 11 / C ++ 0x支持对它进行了排序。
Turned out to be an eclipse error. Creating a new project and re-following the steps Eclipse CDT C++11/C++0x support sorted it.
这篇关于地图上的模板参数无效std :: map< std :: string,Stock *> &股票的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文