Error C2676: std::set::const_iterator doesn't have operator+ function?
问题 std::set<int> s = { 1,2,3,4,5 }; std::set<int> s2(s.begin(), s.begin() + 2); I want to assgin several values of s into s2 . But got below compile error: Error C2676 binary ' + ': ' std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<_Ty>>> ' does not define this operator or a conversion to a type acceptable to the predefined It seems std::set::const_iterator doesn't have operator+ method. 回答1: It seems std::set::const_iterator doesn't have operator+ method. You are right about