c++ - move-only input and output iterators -
concerning inputiterator/outputiterator-s consistent modify semantics move-only? surely mean newly-created custom iterators, not stl ones.
notes semantic requirements ++i
, ++r
expressions input , output iterators correspondingly says:
postcondition: copies of previous value of
i
no longer required either dereferenceable or in domain of==
.after operation
r
not required incrementable , copies of previous value ofr
no longer required dereferenceable or incrementable.
i think safer prohibit possibility have copies of input/output iterators in cases, never heard such advice. bad idea?
input/outputiterators must first satisfy iterator requirement. , requirement say, c++14, [iterator.iterators], p2:
a type
x
satisfiesiterator
requirements if:
x
satisfiescopyconstructible
,copyassignable
, ,destructible
requirements (17.6.3.1)
so no, cannot move-only.
Comments
Post a Comment