Skip to content

Commit d3c1ebf

Browse files
committed
add utility for checking required options passed to constructors
1 parent e29260b commit d3c1ebf

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/adm/detail/named_option_helper.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,17 @@ namespace adm {
1717
setNamedOptionHelper(std::forward<Element>(element), std::move(args)...);
1818
}
1919

20+
/// check that the first template type is present in the remainder
21+
template <typename T>
22+
constexpr bool optionInList() {
23+
return false;
24+
}
25+
26+
template <typename T, typename Param, typename... Params>
27+
constexpr bool optionInList() {
28+
using ParamT = std::remove_const_t<std::remove_reference_t<Param>>;
29+
return std::is_same<T, ParamT>::value || optionInList<T, Params...>();
30+
}
31+
2032
} // namespace detail
2133
} // namespace adm

0 commit comments

Comments
 (0)