Skip to content

Commit 80ea230

Browse files
committed
fix: inline catch2 tag_invoke, make nyu::reset CPO variadic
1 parent 7c827a8 commit 80ea230

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/NyuCatch2TestUtil.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
namespace nyu {
99
struct catch2_test_name_token {};
1010

11-
std::string tag_invoke(::nyu::get_test_name_t, ::nyu::catch2_test_name_token) {
11+
inline std::string tag_invoke(::nyu::get_test_name_t,
12+
::nyu::catch2_test_name_token) {
1213
return Catch::getResultCapture().getCurrentTestName();
1314
}
1415

src/NyuTestUtil.hpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,15 +200,17 @@ using cpo::reset_default;
200200

201201
struct reset_t {
202202
private:
203-
template <typename Dut> static constexpr bool is_nothrow =
204-
tag_invocable<reset_t, Dut&> ? nothrow_tag_invocable<reset_t, Dut&>
205-
: nothrow_reset_default_ok<Dut>;
203+
template <typename Dut, typename... Args> static constexpr bool is_nothrow =
204+
tag_invocable<reset_t, Dut&, Args...>
205+
? nothrow_tag_invocable<reset_t, Dut&, Args...>
206+
: nothrow_reset_default_ok<Dut>;
206207

207208
public:
208-
template <typename Dut> constexpr decltype(auto) operator()(Dut& dut) const
209-
noexcept(is_nothrow<Dut>) {
210-
if constexpr(tag_invocable<reset_t, Dut&>) {
211-
return tag_invoke(*this, dut);
209+
template <typename Dut, typename... Args>
210+
constexpr decltype(auto) operator()(Dut& dut, Args&&... args) const
211+
noexcept(is_nothrow<Dut, Args...>) {
212+
if constexpr(tag_invocable<reset_t, Dut&, Args...>) {
213+
return tag_invoke(*this, dut, std::forward<Args>(args)...);
212214
} else {
213215
return reset_default(dut);
214216
}

0 commit comments

Comments
 (0)