From 91550639bbbd20c92957b83abfbb3ec4c43b3ab4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 21 Nov 2021 11:15:08 +1100 Subject: More C++20 refactorings Use CTAD instead of make functions, requires instead of enable_if --- src/command_manager.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/command_manager.cc') diff --git a/src/command_manager.cc b/src/command_manager.cc index 2c067978..a8212d06 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -297,14 +297,15 @@ Token parse_percent_token(ParseState& state, bool throw_on_unterminated) } } -template> or std::is_same_v>> +template + requires (std::is_same_v> or std::is_same_v) void expand_token(Token&& token, const Context& context, const ShellContext& shell_context, Target& target) { constexpr bool single = std::is_same_v; auto set_target = [&](auto&& s) { if constexpr (single) target = std::move(s); - else if constexpr (std::is_same_v, String>) + else if constexpr (std::is_same_v, String>) target.push_back(std::move(s)); else if constexpr (std::is_same_v&&>) target.insert(target.end(), std::make_move_iterator(s.begin()), std::make_move_iterator(s.end())); -- cgit v1.2.3