From fa24fb22ca7fbec1b2a75a359da394e17568d368 Mon Sep 17 00:00:00 2001 From: Luis Diaz Date: Sun, 13 Mar 2022 15:42:49 +0100 Subject: [PATCH] Use compiler deduction guides for error list --- src/error.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/error.cpp b/src/error.cpp index ecff3c4d..5873e42a 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -13,7 +13,7 @@ namespace { //! Complete list of Exiv2 exception error messages - constexpr std::array(Exiv2::ErrorCode::kerErrorCount)> errList{ + constexpr std::array errList{ N_("Success"), // kerSuccess N_("Error %0: arg2=%2, arg3=%3, arg1=%1."), // KerGeneralError "%1", // kerErrorMessage, @@ -92,6 +92,8 @@ namespace N_("Arithmetic operation overflow"), // kerArithmeticOverflow N_("Memory allocation failed"), // kerMallocFailed }; + static_assert(errList.size() == static_cast(Exiv2::ErrorCode::kerErrorCount), + "errList needs to contain a error msg for every ErrorCode defined in error.hpp"); } // namespace