From 67b1c499d130ac2b768ca396757d0ec2ea8c0b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johel=20Ernesto=20Guerrero=20Pe=C3=B1a?= Date: Sun, 19 Jul 2020 14:27:46 -0400 Subject: [PATCH] refactor: avoid always false comparison --- src/include/units/bits/external/fixed_string.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/include/units/bits/external/fixed_string.h b/src/include/units/bits/external/fixed_string.h index e1d7e2db..4e531795 100644 --- a/src/include/units/bits/external/fixed_string.h +++ b/src/include/units/bits/external/fixed_string.h @@ -44,7 +44,8 @@ struct basic_fixed_string { constexpr basic_fixed_string(const CharT (&txt)[N + 1]) noexcept { - for (std::size_t i = 0; i < N; ++i) data_[i] = txt[i]; + if constexpr (N != 0) + for (std::size_t i = 0; i < N; ++i) data_[i] = txt[i]; } [[nodiscard]] constexpr std::size_t size() const noexcept { return N; }