From cf7db48c261ee9c896c813a38ff8c59da5b8fe07 Mon Sep 17 00:00:00 2001 From: Steven Le Rouzic Date: Sun, 26 Jan 2025 00:40:51 +0100 Subject: Fix line endings --- asl/maybe_uninit.hpp | 144 +++++++++++++++++++++++++-------------------------- 1 file changed, 72 insertions(+), 72 deletions(-) (limited to 'asl/maybe_uninit.hpp') diff --git a/asl/maybe_uninit.hpp b/asl/maybe_uninit.hpp index 4f60e4d..a69f39b 100644 --- a/asl/maybe_uninit.hpp +++ b/asl/maybe_uninit.hpp @@ -1,72 +1,72 @@ -#pragma once - -#include "asl/meta.hpp" -#include "asl/utility.hpp" -#include "asl/memory.hpp" - -namespace asl -{ - -template -union maybe_uninit -{ -private: - T m_value; - -public: - constexpr maybe_uninit() requires trivially_default_constructible = default; - constexpr maybe_uninit() requires (!trivially_default_constructible) {} // NOLINT - - template - explicit constexpr maybe_uninit(in_place_t, Args&&... args) - requires constructible_from - : m_value{ASL_FWD(args)...} - {} - - constexpr maybe_uninit(const maybe_uninit&) requires trivially_copy_constructible = default; - constexpr maybe_uninit(const maybe_uninit&) requires (!trivially_copy_constructible) {} // NOLINT - - constexpr maybe_uninit(maybe_uninit&&) requires trivially_move_constructible = default; - constexpr maybe_uninit(maybe_uninit&&) requires (!trivially_move_constructible) {} // NOLINT - - constexpr maybe_uninit& operator=(const maybe_uninit&) requires trivially_copy_assignable = default; - constexpr maybe_uninit& operator=(const maybe_uninit&) requires (!trivially_copy_assignable) {} - - constexpr maybe_uninit& operator=(maybe_uninit&&) requires trivially_move_assignable = default; - constexpr maybe_uninit& operator=(maybe_uninit&&) requires (!trivially_move_assignable) {} - - constexpr ~maybe_uninit() requires trivially_destructible = default; - constexpr ~maybe_uninit() requires (!trivially_destructible) {} // NOLINT - - // @Safety Value must not have been initialized yet - template - constexpr void construct_unsafe(Args&&... args) - requires constructible_from - { - construct_at(&m_value, ASL_FWD(args)...); - } - - // @Safety Value must have been initialized - template - constexpr void assign_unsafe(U&& value) - requires assignable_from - { - m_value = ASL_FWD(value); - } - - // @Safety Value must have been initialized - constexpr void destroy_unsafe() - { - if constexpr (!trivially_destructible) - { - destroy(&m_value); - } - } - - // @Safety Value must have been initialized - constexpr const T& as_init_unsafe() const& { return m_value; } - constexpr T& as_init_unsafe() & { return m_value; } - constexpr T&& as_init_unsafe() && { return ASL_MOVE(m_value); } -}; - -} // namespace asl +#pragma once + +#include "asl/meta.hpp" +#include "asl/utility.hpp" +#include "asl/memory.hpp" + +namespace asl +{ + +template +union maybe_uninit +{ +private: + T m_value; + +public: + constexpr maybe_uninit() requires trivially_default_constructible = default; + constexpr maybe_uninit() requires (!trivially_default_constructible) {} // NOLINT + + template + explicit constexpr maybe_uninit(in_place_t, Args&&... args) + requires constructible_from + : m_value{ASL_FWD(args)...} + {} + + constexpr maybe_uninit(const maybe_uninit&) requires trivially_copy_constructible = default; + constexpr maybe_uninit(const maybe_uninit&) requires (!trivially_copy_constructible) {} // NOLINT + + constexpr maybe_uninit(maybe_uninit&&) requires trivially_move_constructible = default; + constexpr maybe_uninit(maybe_uninit&&) requires (!trivially_move_constructible) {} // NOLINT + + constexpr maybe_uninit& operator=(const maybe_uninit&) requires trivially_copy_assignable = default; + constexpr maybe_uninit& operator=(const maybe_uninit&) requires (!trivially_copy_assignable) {} + + constexpr maybe_uninit& operator=(maybe_uninit&&) requires trivially_move_assignable = default; + constexpr maybe_uninit& operator=(maybe_uninit&&) requires (!trivially_move_assignable) {} + + constexpr ~maybe_uninit() requires trivially_destructible = default; + constexpr ~maybe_uninit() requires (!trivially_destructible) {} // NOLINT + + // @Safety Value must not have been initialized yet + template + constexpr void construct_unsafe(Args&&... args) + requires constructible_from + { + construct_at(&m_value, ASL_FWD(args)...); + } + + // @Safety Value must have been initialized + template + constexpr void assign_unsafe(U&& value) + requires assignable_from + { + m_value = ASL_FWD(value); + } + + // @Safety Value must have been initialized + constexpr void destroy_unsafe() + { + if constexpr (!trivially_destructible) + { + destroy(&m_value); + } + } + + // @Safety Value must have been initialized + constexpr const T& as_init_unsafe() const& { return m_value; } + constexpr T& as_init_unsafe() & { return m_value; } + constexpr T&& as_init_unsafe() && { return ASL_MOVE(m_value); } +}; + +} // namespace asl -- cgit