Wouldn't it be better to return (size_t)-1 here?