c++17在不知道兩個std::any對象所含對象的類型信息的情況下,如何判斷兩個std::any對象是否相等?
4 回答

蕭十郎
TA貢獻1815條經驗 獲得超13個贊
std::any::type
The typeid of the contained value if instance is non-empty, otherwise typeid(void).
然后再any_cast吧,別的什么RTTI不都是根據type_info弄的嗎。

守著一只汪
TA貢獻1872條經驗 獲得超4個贊
intput和output成員函數都是屬于 TrainingItem的,而不是屬于vector<TrainingItem>的,因此如果要訪問這兩個成員函數,那么就應該使用迭代器或下標取出vector容器中的成員。
比如 training_set[0].output() 這樣
添加回答
舉報
0/150
提交
取消