From ba077697d69f233c71e072f49980abf9b5c51f77 Mon Sep 17 00:00:00 2001 From: DapengFeng Date: Fri, 22 Nov 2024 16:50:35 +0800 Subject: [PATCH] support `store_into` std::filesystem::path --- include/argparse/argparse.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/argparse/argparse.hpp b/include/argparse/argparse.hpp index c8c99b6..b90f3c1 100644 --- a/include/argparse/argparse.hpp +++ b/include/argparse/argparse.hpp @@ -57,6 +57,7 @@ SOFTWARE. #include #include #include +#include #endif #ifndef ARGPARSE_CUSTOM_STRTOF @@ -730,6 +731,14 @@ class Argument { return *this; } + auto &store_into(std::filesystem::path &var) { + if (m_default_value.has_value()) { + var = std::any_cast(m_default_value); + } + action([&var](const std::string &s) { var = s; }); + return *this; + } + auto &store_into(std::vector &var) { if (m_default_value.has_value()) { var = std::any_cast>(m_default_value);