我是新來的,現在確定這是否可行。我想將一個參數std::set<std::string>
添加到函數中,並將其默認值設置爲NULL
,以避免對以前的使用產生影響。我可以使用std :: set <std::string>作爲函數的默認參數嗎?
所以基本上,
func(int a); turns into
func(int a, std::set<std::string> & temp = NULL);
但是這會給我一個錯誤"error C2440: 'default argument' : cannot convert from 'int' to 'std::set<_Kty> &'"
任何人可以幫助我在這?
感謝
我不知道,你可以有'NULL'參考。 (而不是指針) – millimoose 2012-02-04 01:17:43