0
template <type1 _Type1, type2 _Comparator=... >
我想實現一個類。第一個參數可以是一個字符串,一個集合或一個列表。第二個參數是一個比較器。我想使用比較器<作爲type2的默認參數。默認參數和通用類
我沒有找到這個正確的語法,可能你幫幫我好嗎?
編輯:給出的答案是好的,但不是我的情況。 我意識到,我一直在尋找:
template <typename _Type, typename _Comparator=less<typename _Type::value_type> >
,而不是
template< class Type1, class Comparator = std::less<Type1> >
因爲我需要比較哪些是_Type的部分元素。
怎麼樣'的std ::少' –
沒錯,謝謝。 – anothertest