From 8b7192e67039049328e64bbb8bbbad04a721126b Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Sun, 14 Jan 2024 10:35:25 +0100 Subject: [PATCH] enhance: Add Args::push_back(std::string&& arg) --- src/Args.cpp | 8 +------- src/Args.hpp | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Args.cpp b/src/Args.cpp index 4349654a3..44a09ddbf 100644 --- a/src/Args.cpp +++ b/src/Args.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2023 Joel Rosdahl and other contributors +// Copyright (C) 2020-2024 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -238,12 +238,6 @@ Args::pop_front(size_t count) m_args.erase(m_args.begin(), m_args.begin() + count); } -void -Args::push_back(const std::string& arg) -{ - m_args.push_back(arg); -} - void Args::push_back(const Args& args) { diff --git a/src/Args.hpp b/src/Args.hpp index 825e95be4..0370d09f5 100644 --- a/src/Args.hpp +++ b/src/Args.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2022 Joel Rosdahl and other contributors +// Copyright (C) 2020-2024 Joel Rosdahl and other contributors // // See doc/AUTHORS.adoc for a complete list of contributors. // @@ -82,6 +82,7 @@ public: // Add `arg` to the end. void push_back(const std::string& arg); + void push_back(std::string&& arg); // Add `args` to the end. void push_back(const Args& args); @@ -131,3 +132,15 @@ Args::operator[](size_t i) { return m_args[i]; } + +inline void +Args::push_back(const std::string& arg) +{ + m_args.push_back(arg); +} + +inline void +Args::push_back(std::string&& arg) +{ + m_args.push_back(arg); +} -- 2.39.2