Skip to content

Commit 95fed9f

Browse files
authored
Merge pull request #741 from elbeno/fix-msg-constructor
🎨 Add `constexpr` to a message view constructor
2 parents 703623d + 126ea30 commit 95fed9f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/msg/message.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ struct message {
387387

388388
template <detail::storage_like S>
389389
// NOLINTNEXTLINE(google-explicit-constructor)
390-
explicit(false) view_t(S const &s) : storage{s} {}
390+
constexpr explicit(false) view_t(S const &s) : storage{s} {}
391391

392392
template <detail::storage_like S, some_field_value... Vs>
393393
constexpr explicit view_t(S &s, Vs... vs) : storage{s} {
@@ -400,7 +400,7 @@ struct message {
400400
: storage{s.data()} {}
401401

402402
template <typename S, some_field_value... Vs>
403-
explicit(true) constexpr view_t(owner_t<S> &s LIFETIMEBOUND, Vs... vs)
403+
constexpr explicit(true) view_t(owner_t<S> &s LIFETIMEBOUND, Vs... vs)
404404
: storage{s.data()} {
405405
this->set(vs...);
406406
}
@@ -470,7 +470,7 @@ struct message {
470470
this->set(Fields{}...);
471471
}
472472

473-
template <some_field_value... Vs> explicit constexpr owner_t(Vs... vs) {
473+
template <some_field_value... Vs> constexpr explicit owner_t(Vs... vs) {
474474
using defaulted_fields = boost::mp11::mp_transform<
475475
name_for,
476476
boost::mp11::mp_copy_if<boost::mp11::mp_list<Fields...>,
@@ -493,7 +493,7 @@ struct message {
493493
}
494494

495495
template <detail::storage_like S, some_field_value... Vs>
496-
explicit constexpr owner_t(S const &s, Vs... vs) {
496+
constexpr explicit owner_t(S const &s, Vs... vs) {
497497
static_assert(std::is_same_v<typename S::value_type,
498498
typename storage_t::value_type>,
499499
"Attempted to construct owning message with "
@@ -506,7 +506,7 @@ struct message {
506506
}
507507

508508
template <detail::storage_like S, some_field_value... Vs>
509-
explicit constexpr owner_t(view_t<S> s, Vs... vs)
509+
constexpr explicit owner_t(view_t<S> s, Vs... vs)
510510
: owner_t{s.data(), vs...} {}
511511

512512
[[nodiscard]] constexpr auto data() LIFETIMEBOUND {

0 commit comments

Comments
 (0)