f_maybe.h 739 B

1234567891011121314151617181920212223
  1. #pragma once
  2. #include <util/generic/maybe.h>
  3. namespace NUnifiedAgent {
  4. template <typename T>
  5. using TFMaybe = TMaybe<T, ::NMaybe::TPolicyUndefinedFail>;
  6. template <class T>
  7. inline constexpr TFMaybe<std::decay_t<T>> MakeFMaybe(T&& value) {
  8. return TMaybe<std::decay_t<T>, ::NMaybe::TPolicyUndefinedFail>(std::forward<T>(value));
  9. }
  10. template <class T, class... TArgs>
  11. inline constexpr TFMaybe<T> MakeFMaybe(TArgs&&... args) {
  12. return TFMaybe<T>(typename TFMaybe<T>::TInPlace{}, std::forward<TArgs>(args)...);
  13. }
  14. template <class T>
  15. inline constexpr TFMaybe<std::decay_t<T>> MakeFMaybe(const TMaybe<T>& source) {
  16. return source.Defined() ? MakeFMaybe(*source) : Nothing();
  17. }
  18. }