Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
PragmaTwice committed Jan 25, 2024
1 parent 0b4978d commit 33950bf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/commands/command_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "parse_util.h"
#include "status.h"
#include "string_util.h"
#include "type_util.h"

template <typename Iter>
struct MoveIterator : Iter {
Expand All @@ -47,22 +48,26 @@ struct CommandParser {

CommandParser(Iter begin, Iter end) : begin_(std::move(begin)), end_(std::move(end)) {}

template <typename Container, std::enable_if_t<std::is_lvalue_reference_v<Container>, int> = 0>
template <typename Container, std::enable_if_t<std::is_lvalue_reference_v<Container> &&
!std::is_same_v<RemoveCVRef<Container>, CommandParser>,
int> = 0>
explicit CommandParser(Container&& con, size_t skip_num = 0) : CommandParser(std::begin(con), std::end(con)) {
std::advance(begin_, skip_num);
}

template <typename Container, std::enable_if_t<!std::is_lvalue_reference_v<Container>, int> = 0>
template <typename Container, std::enable_if_t<!std::is_lvalue_reference_v<Container> &&
!std::is_same_v<RemoveCVRef<Container>, CommandParser>,
int> = 0>
explicit CommandParser(Container&& con, size_t skip_num = 0)
: CommandParser(MoveIterator(std::begin(con)), MoveIterator(std::end(con))) {
std::advance(begin_, skip_num);
}

CommandParser(const CommandParser&) = default;
CommandParser(CommandParser&&) = default;
CommandParser(CommandParser&&) noexcept = default;

CommandParser& operator=(const CommandParser&) = default;
CommandParser& operator=(CommandParser&&) = default;
CommandParser& operator=(CommandParser&&) noexcept = default;

~CommandParser() = default;

Expand Down

0 comments on commit 33950bf

Please sign in to comment.