#pragma once #include #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// namespace NDetail { template struct TIsInvocable; template struct TIsInvocable { private: static constexpr bool IsInvocable_ = requires (T&& t, TArgs&&... args) { { std::forward(t)(std::forward(args)...) } -> std::same_as; }; static constexpr bool IsNoThrowInvocable_ = requires (T&& t, TArgs&&... args) { { std::forward(t)(std::forward(args)...) } noexcept -> std::same_as; }; public: static constexpr bool Value = IsInvocable_ && (!NoExcept || IsNoThrowInvocable_); }; template struct TIsEmpty : public T { int Dummy; static constexpr bool Value = (sizeof(TIsEmpty) == sizeof(int)); }; } // namespace NDetail //////////////////////////////////////////////////////////////////////////////// template concept CScalable = requires (TObject object, TScalar scalar) { { object * scalar } -> std::same_as; }; //////////////////////////////////////////////////////////////////////////////// template concept CInvocable = NDetail::TIsInvocable::Value; //////////////////////////////////////////////////////////////////////////////// template concept CStdVector = requires (V& vec) { [] (std::vector&) { } (vec); }; //////////////////////////////////////////////////////////////////////////////// template concept CAnyMap = requires { typename M::mapped_type; typename M::key_type; }; //////////////////////////////////////////////////////////////////////////////// template concept CConst = std::is_const_v; template concept CNonConst = !CConst; //////////////////////////////////////////////////////////////////////////////// template concept CRawPtr = std::is_pointer_v; template concept CConstRawPtr = CRawPtr && CConst())>; template concept CMutableRawPtr = CRawPtr && !CConstRawPtr; //////////////////////////////////////////////////////////////////////////////// template constexpr bool IsEmptyClass() { return NDetail::TIsEmpty::Value; } //////////////////////////////////////////////////////////////////////////////// } // namespace NYT