Defined in header <cparse/Parser.hh>

bool hasErrors() const noexcept;

Returns true if any ParseError has been recorded, false otherwise. Equivalent to !errors().empty().

Parameters

None.

Return value

true if the collector contains at least one entry, false if it is empty.

Exceptions

noexcept.

Notes

Useful for distinguishing "parse succeeded silently" from "parse succeeded with warnings":

bool const ok = p.parse("input.txt");
if (ok && !p.hasErrors())      // clean success
    ...
else if (ok && p.hasErrors())  // succeeded with warnings
    ...
else                            // failed
    ...

See also