diff options
author | melkov <melkov@yandex-team.com> | 2023-08-16 01:17:57 +0300 |
---|---|---|
committer | melkov <melkov@yandex-team.com> | 2023-08-16 02:26:50 +0300 |
commit | febd7aad1485f0c7366b71363d3ec2f37281d5b1 (patch) | |
tree | 33f2dbfaca850661b70941c9f1a8270d20a05ef2 /library/cpp | |
parent | 36bc9ed652bd6edb13dee861dc1fc958a4a76e9f (diff) | |
download | ydb-febd7aad1485f0c7366b71363d3ec2f37281d5b1.tar.gz |
Support StoreResult to std::optional in LastGetopt
Diffstat (limited to 'library/cpp')
-rw-r--r-- | library/cpp/getopt/small/last_getopt_opt.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/cpp/getopt/small/last_getopt_opt.h b/library/cpp/getopt/small/last_getopt_opt.h index 5210b6e756..4ffdfc394a 100644 --- a/library/cpp/getopt/small/last_getopt_opt.h +++ b/library/cpp/getopt/small/last_getopt_opt.h @@ -10,6 +10,7 @@ #include <util/generic/vector.h> #include <util/string/cast.h> +#include <optional> #include <stdarg.h> namespace NLastGetopt { @@ -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)); |