Skip to content

Commit

Permalink
Use compiler deduction guides for error list
Browse files Browse the repository at this point in the history
  • Loading branch information
piponazo committed Mar 13, 2022
1 parent 8d6901c commit fa24fb2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/error.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
namespace
{
//! Complete list of Exiv2 exception error messages
constexpr std::array<const char*, static_cast<size_t>(Exiv2::ErrorCode::kerErrorCount)> errList{
constexpr std::array errList{
N_("Success"), // kerSuccess
N_("Error %0: arg2=%2, arg3=%3, arg1=%1."), // KerGeneralError
"%1", // kerErrorMessage,
Expand Down Expand Up @@ -92,6 +92,8 @@ namespace
N_("Arithmetic operation overflow"), // kerArithmeticOverflow
N_("Memory allocation failed"), // kerMallocFailed
};
static_assert(errList.size() == static_cast<size_t>(Exiv2::ErrorCode::kerErrorCount),
"errList needs to contain a error msg for every ErrorCode defined in error.hpp");

} // namespace

Expand Down

0 comments on commit fa24fb2

Please sign in to comment.