Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions include/clipp.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include <utility>
#include <iterator>
#include <functional>

#include <unordered_set>

/*************************************************************************//**
*
Expand Down Expand Up @@ -160,7 +160,7 @@ constexpr auto
check_is_callable(int) -> decltype(
std::declval<Fn>()(std::declval<Args>()...),
std::integral_constant<bool,
std::is_same<Ret,typename std::result_of<Fn(Args...)>::type>::value>{} );
std::is_same_v<Ret, std::invoke_result_t<Fn, Args...>>>{} );

template<class,class,class...>
constexpr auto
Expand All @@ -171,7 +171,7 @@ constexpr auto
check_is_callable_without_arg(int) -> decltype(
std::declval<Fn>()(),
std::integral_constant<bool,
std::is_same<Ret,typename std::result_of<Fn()>::type>::value>{} );
std::is_same_v<Ret, std::invoke_result_t<Fn>>>{} );

template<class,class>
constexpr auto
Expand Down Expand Up @@ -350,7 +350,7 @@ inline T clamped_on_limits(const V& v) {
template<class T>
struct make {
static inline T from(const char* s) {
if(!s) return false;
if(!s) return T{};
//a conversion from const char* to / must exist
return static_cast<T>(s);
}
Expand Down Expand Up @@ -6563,7 +6563,7 @@ class documentation
doc_formatting usgFmt_;
filter_function filter_;
enum class paragraph { param, group };

mutable std::unordered_set<std::string> printed_param_keys_;

/***************************************************************//**
*
Expand All @@ -6578,6 +6578,7 @@ class documentation
fos.hanging_indent(0);
fos.paragraph_spacing(0);
fos.ignore_newline_chars(fmt_.ignore_newline_chars());
printed_param_keys_.clear();
print_doc(fos, cli_);
}

Expand Down Expand Up @@ -6637,9 +6638,17 @@ class documentation
else {
const auto& p = ptrn.as_param();
if(!filter_(p)) return;

auto label = param_label(p, fmt_);
std::string key = label.c_str();
key += p.doc();

if (!printed_param_keys_.insert(key).second) {
return;
}

handle_spacing(os, paragraph::param, indentLvl);
print_entry(os, param_label(p, fmt_), p.doc());
print_entry(os, label, p.doc());
}
}

Expand Down