Skip to content

Commit

Permalink
cmd_line_parser flag: more conversion operators
Browse files Browse the repository at this point in the history
  • Loading branch information
felixguendling committed Oct 4, 2024
1 parent 538a11d commit b50b51c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/utl/cmd_line_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ struct cmd_line_flag : public Tags... {
operator T() { return t; }
T& val() { return t; }
T const& val() const { return t; }
T const& operator*() const { return t; }
T& operator*() { return t; }
T t{};
};

template <typename T>
inline T parse(int argc, char const** argv) {
inline T parse_flags(int argc, char const** argv) {
auto parse_flag = [](auto& val, cstr next_arg) {
using FieldType = std::remove_cv_t<std::remove_reference_t<decltype(val)>>;
if constexpr (std::is_same_v<FieldType, bool>) {
Expand Down

0 comments on commit b50b51c

Please sign in to comment.