diff --git a/src/Utility.vcxproj b/src/Utility.vcxproj index ecc5ac0..35197a0 100644 --- a/src/Utility.vcxproj +++ b/src/Utility.vcxproj @@ -194,6 +194,7 @@ + diff --git a/src/Utility.vcxproj.filters b/src/Utility.vcxproj.filters index 62f1413..5be4206 100644 --- a/src/Utility.vcxproj.filters +++ b/src/Utility.vcxproj.filters @@ -164,6 +164,9 @@ 헤더 파일\Reflection + + 헤더 파일\Functional + diff --git a/src/functional/Promise.ixx b/src/functional/Promise.ixx new file mode 100644 index 0000000..0c3dee5 --- /dev/null +++ b/src/functional/Promise.ixx @@ -0,0 +1,77 @@ +export module Utility.Promise; +import Utility; +import Utility.Constraints; + +export namespace util +{ + template + struct noexcept_t + { + template + static consteval bool Eval() noexcept + { + if constexpr (!same_as) + { + return nothrow_invocables; + } + else + { + return nothrow_invocables; + } + } + + template + requires (same_as) + static constexpr auto Execute(Fn&& functor, [[maybe_unused]] Args...) noexcept(noexcept(forward(functor)())) + { + return forward(functor)(); + } + + template + requires (!same_as) + static constexpr auto Execute(Fn&& functor, Args&&... args) noexcept(noexcept(forward(functor)(forward(args)...))) + { + return forward(functor)(forward(args)...); + } + }; + + /// + /// + /// + /// Sucess + /// Error + /// Cause of Defer + template + class Promise + { + + }; +} + +#pragma warning(push, 1) +namespace test +{ +#if false + void test_promise() noexcept + { + constexpr auto fnl0 = [](const int& v) -> int { + return 300; + }; + + constexpr auto fnr0 = [](int&&) -> int { + return 300; + }; + + Promise vpromise0{}; + const auto r0 = vpromise0 >> fnl0; + Promise vpromise1{}; + + constexpr Promise cvpromise0{}; + + constexpr Promise cvpromise1{}; + + constexpr Proxy proxy0{}; + } +#endif // false +} +#pragma warning(pop)