From e461c17c24115132601362a96b6a85c0dd12f471 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Tue, 1 Jul 2025 19:21:05 +0100 Subject: construct: add final and [[nodiscard]] --- nihil.util/construct.ccm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'nihil.util/construct.ccm') diff --git a/nihil.util/construct.ccm b/nihil.util/construct.ccm index 0a0d85d..894a446 100644 --- a/nihil.util/construct.ccm +++ b/nihil.util/construct.ccm @@ -8,14 +8,15 @@ namespace nihil { // A functor that constructs objects of an arbitrary type. // Useful for std::views::transform. template -struct construct_fn { - auto operator()(this construct_fn const &, auto &&...args) -> T +struct construct_fn final +{ + [[nodiscard]] auto operator()(this construct_fn const &, auto &&...args) -> T { return T(std::forward(args)...); } }; -export template +export template inline constexpr auto construct = construct_fn{}; -} +} // namespace nihil -- cgit v1.2.3