In a scenario where a custom find()
method of a custom class returns index position of an element in a custom data structure, is there something more elegant than returning string::npos
?
The return type of the find()
method is size_t
. So I need it to be of type size_t.
string::npos
is -1
, which is the maximum value of unsigned long long
. While this works great, my issue with it is the naming: string
. I'd prefer not to have any association to string
. Is there anything built in more generally named for such a common and general scenario and compatible with size_t
?