By storing it as size_t we explicitly disallow negative line numbers,
and keep 0 as an error/empty/undefined location.
A small problem with this is that MessageContainer.error and friends
still accept negative numbers (often without warning) via size_t
implicit conversion and wrap-around.
For more transactional behaviour and to support MessageContainer in
favour of opm-log, this method now returns an enum describing how the
error should be handled, rather than throwing or no-oping. Throwing is
preserved if ParseContext is configured to do so.
While the implementation is a simple alias to
std::vector<Message>::const_iterator, it enablese generic lookup of the
iterator type at compile time, and enables us to effortlessly change the
underlying implementation later.
Some phenomenons can be configured as error, warning or debug output,
and is not necessarily known in advanced by the entity adding a message.
To facilite adding a message with runtime-defined warning level, the add
method is supported.
By supporting operator bool() we get the same existence checking
capabilities as the unique_ptr implementations, without the hurdles of
non-copyability and manual heap allocation.