I have problems solving a problem in my program. Thus, at present, each piece returns an iterator, but the iterator depends on two cases:
the desired item is in the piece: the return resultIter;
desired item was not found in the piece: 'return nullptr`
the first case is quite simple and easy to solve, but in the second case I ran into a problem. Given a template argument InIter, how can I convert nullptrto a category InIter?
template< typename InIter, ...>
InInter func(...) {
InIter res =
loop(...)
if(token.was_cancelled())
return res;
return nullptr;
}
which gives me this error:
'nullptr': all returned expressions in lambda must be of the same type: earlier it was "test :: test_iterator"
, -, , . , , .
:
return InIter(nullptr);
return (InIter)(nullptr);
return NULL;
return InIter(NULL);
...
, . , , ?