Skip to content

Commit fa24fb2

Browse files
committed
Use compiler deduction guides for error list
1 parent 8d6901c commit fa24fb2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/error.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
namespace
1414
{
1515
//! Complete list of Exiv2 exception error messages
16-
constexpr std::array<const char*, static_cast<size_t>(Exiv2::ErrorCode::kerErrorCount)> errList{
16+
constexpr std::array errList{
1717
N_("Success"), // kerSuccess
1818
N_("Error %0: arg2=%2, arg3=%3, arg1=%1."), // KerGeneralError
1919
"%1", // kerErrorMessage,
@@ -92,6 +92,8 @@ namespace
9292
N_("Arithmetic operation overflow"), // kerArithmeticOverflow
9393
N_("Memory allocation failed"), // kerMallocFailed
9494
};
95+
static_assert(errList.size() == static_cast<size_t>(Exiv2::ErrorCode::kerErrorCount),
96+
"errList needs to contain a error msg for every ErrorCode defined in error.hpp");
9597

9698
} // namespace
9799

0 commit comments

Comments
 (0)