#Implementation
Implementation
operator==(SplitStringIterator const&)
only compares pointers for equality, not lengths. This might not be intended.- The
ForwardIterator
concept isn't actually fulfilled: For that,operator*
has to return areference
! (And it makes sense, too: You cannot provide a multipass guarantee in case the contents get modified, i.e. a previously differentCharT
value gets changed todelim
.) - Why restrict
delim
toCharT
, when it could just as easily be astd::basic_string_view<CharT>
? Theadvance_()
logic would have to be updated for the varying length, but that's the only non-type change I can see that would be necessary. (Though one could add a conversion or a special case for singleCharT
delimiters.)
Small caveat: If
parts_indexable
had a longer lifetime thandata
(e.g. it got returned byfoo
), all its contents would dangle (though this is inherent problem ofstd::string_view
, and not of your implementation). This could be fixed by making explicit copies by changing the type ofparts_indexable
tostd::vector<std::string>
. (Not a criticism of your work, just a note for users of this iterator).