I have a struct Foo
. In pseudocode:
def FindFoo:
foo = results of search
foundFoo = true if a valid foo has been found
return foo if foundFoo else someErrorCode
How can I accomplish this in C++?
Edited to remove numerous inaccuracies.
Foo&
; if it fails, it isErrorCode
. A solution to this problem would be to return aFoo*
, which points to the element that was found, or is NULL if no element was found. – Uglify