MSVC里弄了个条件定义,set时确实也是iterator = _Tree_const_iterator<_Scary_val>
template <class _Traits>
class _Tree { // ordered red-black tree for map/multimap/set/multiset
public:
static constexpr bool _Is_set = is_same_v<key_type, value_type>;
public:
using iterator = conditional_t<_Is_set, _Tree_const_iterator<_Scary_val>, _Tree_iterator<_Scary_val>>;
【 在 gameplayer 的大作中提到: 】
: 差不多,glibc中set的iterator和const_iterator是相同的,在stl_set.h中有:
: // _GLIBCXX_RESOLVE_LIB_DEFECTS
: // DR 103. set::iterator is required to be modifiable,
: ...................
--
FROM 61.48.130.*