Skip to content

Commit

Permalink
Support StoreResult to std::optional in LastGetopt
Browse files Browse the repository at this point in the history
  • Loading branch information
melkov authored and antonmyagkov committed Jul 23, 2024
1 parent cabd051 commit 0595fbe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/cpp/getopt/small/last_getopt_opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <util/generic/vector.h>
#include <util/string/cast.h>

#include <optional>
#include <stdarg.h>

namespace NLastGetopt {
Expand Down Expand Up @@ -628,6 +629,11 @@ namespace NLastGetopt {
return StoreResultT<T>(target);
}

template <typename T>
TOpt& StoreResult(std::optional<T>* target) {
return StoreResultT<T>(target);
}

template <typename TpVal, typename T, typename TpDef>
TOpt& StoreResultT(T* target, const TpDef& def) {
return Handler1T<TpVal>(def, NPrivate::TStoreResultFunctor<T, TpVal>(target));
Expand Down

0 comments on commit 0595fbe

Please sign in to comment.