Why does string::find return size_type and not an iterator?
Posted
by dehmann
on Stack Overflow
See other posts from Stack Overflow
or by dehmann
Published on 2010-06-17T13:22:22Z
Indexed on
2010/06/17
13:33 UTC
Read the original article
Hit count: 128
In C++, why does string::find
return size_type
and not an iterator
?
It would make sense because functions like string::replace
or string::insert
take iterators as input, so you could find
some character and immediately pass the returned iterator to replace
, etc.
Also, std::find
returns an iterator -- why is std::string::find
different?
© Stack Overflow or respective owner