From 126ea306a0064fbe490ddbafb0151349d1c2e218 Mon Sep 17 00:00:00 2001 From: Ben Deane Date: Wed, 25 Jun 2025 15:59:30 -0600 Subject: [PATCH] :art: Add `constexpr` to a message view constructor Problem: - For some unknown reason, one of the message view constructors is not marked `constexpr`. Solution: - Mark it `constexpr`. - Also, make the ordering of `constexpr explicit` consistent. --- include/msg/message.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/msg/message.hpp b/include/msg/message.hpp index 22fd9c69..8986c2e7 100644 --- a/include/msg/message.hpp +++ b/include/msg/message.hpp @@ -387,7 +387,7 @@ struct message { template // NOLINTNEXTLINE(google-explicit-constructor) - explicit(false) view_t(S const &s) : storage{s} {} + constexpr explicit(false) view_t(S const &s) : storage{s} {} template constexpr explicit view_t(S &s, Vs... vs) : storage{s} { @@ -400,7 +400,7 @@ struct message { : storage{s.data()} {} template - explicit(true) constexpr view_t(owner_t &s LIFETIMEBOUND, Vs... vs) + constexpr explicit(true) view_t(owner_t &s LIFETIMEBOUND, Vs... vs) : storage{s.data()} { this->set(vs...); } @@ -470,7 +470,7 @@ struct message { this->set(Fields{}...); } - template explicit constexpr owner_t(Vs... vs) { + template constexpr explicit owner_t(Vs... vs) { using defaulted_fields = boost::mp11::mp_transform< name_for, boost::mp11::mp_copy_if, @@ -493,7 +493,7 @@ struct message { } template - explicit constexpr owner_t(S const &s, Vs... vs) { + constexpr explicit owner_t(S const &s, Vs... vs) { static_assert(std::is_same_v, "Attempted to construct owning message with " @@ -506,7 +506,7 @@ struct message { } template - explicit constexpr owner_t(view_t s, Vs... vs) + constexpr explicit owner_t(view_t s, Vs... vs) : owner_t{s.data(), vs...} {} [[nodiscard]] constexpr auto data() LIFETIMEBOUND {