From 03f4c11266cb59bb10cb6945d934a683748b80e4 Mon Sep 17 00:00:00 2001 From: sha512sum Date: Mon, 2 Sep 2024 16:16:32 +0000 Subject: [PATCH] Add constexpr to jid setters --- library/include/larra/jid.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/library/include/larra/jid.hpp b/library/include/larra/jid.hpp index bd7408f..92ed2cd 100644 --- a/library/include/larra/jid.hpp +++ b/library/include/larra/jid.hpp @@ -13,12 +13,12 @@ struct BareJid { friend auto ToString(const BareJid& jid) -> std::string; template - [[nodiscard]] auto Username(this Self&& self, std::string username) -> BareJid { + [[nodiscard]] constexpr auto Username(this Self&& self, std::string username) -> BareJid { return utils::FieldSetHelper::With<"username", BareJid>(std::forward(self), std::move(username)); } template - [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareJid { + [[nodiscard]] constexpr auto Server(this Self&& self, std::string server) -> BareJid { return utils::FieldSetHelper::With<"server", BareJid>(std::forward(self), std::move(server)); } }; @@ -30,12 +30,12 @@ struct BareResourceJid { friend auto ToString(const BareResourceJid& jid) -> std::string; template - [[nodiscard]] auto Server(this Self&& self, std::string server) -> BareResourceJid { + [[nodiscard]] constexpr auto Server(this Self&& self, std::string server) -> BareResourceJid { return utils::FieldSetHelper::With<"server", BareResourceJid>(std::forward(self), std::move(server)); } template - [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> BareResourceJid { + [[nodiscard]] constexpr auto Resource(this Self&& self, std::string resource) -> BareResourceJid { return utils::FieldSetHelper::With<"resource", BareResourceJid>(std::forward(self), std::move(resource)); } }; @@ -48,17 +48,17 @@ struct FullJid { friend auto ToString(const FullJid& jid) -> std::string; template - [[nodiscard]] auto Username(this Self&& self, std::string username) -> FullJid { + [[nodiscard]] constexpr auto Username(this Self&& self, std::string username) -> FullJid { return utils::FieldSetHelper::With<"username", FullJid>(std::forward(self), std::move(username)); }; template - [[nodiscard]] auto Server(this Self&& self, std::string server) -> FullJid { + [[nodiscard]] constexpr auto Server(this Self&& self, std::string server) -> FullJid { return utils::FieldSetHelper::With<"server", FullJid>(std::forward(self), std::move(server)); }; template - [[nodiscard]] auto Resource(this Self&& self, std::string resource) -> FullJid { + [[nodiscard]] constexpr auto Resource(this Self&& self, std::string resource) -> FullJid { return utils::FieldSetHelper::With<"resource", FullJid>(std::forward(self), std::move(resource)); }; };