diff options
Diffstat (limited to 'gdbsupport/gdb_argv_vec.h')
-rw-r--r-- | gdbsupport/gdb_argv_vec.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdbsupport/gdb_argv_vec.h b/gdbsupport/gdb_argv_vec.h index 1f3b6db..43571ae 100644 --- a/gdbsupport/gdb_argv_vec.h +++ b/gdbsupport/gdb_argv_vec.h @@ -90,6 +90,15 @@ public: m_args.push_back (value); } + /* Like calling emplace_back on the underlying vector. This class takes + ownership of the value added to the vector, and will release the value + by calling xfree() on it when this object is destroyed. */ + template<typename... Args> + reference emplace_back (Args &&...args) + { + return m_args.emplace_back (std::forward<Args> (args)...); + } + /* Non constant iterator to start of m_args. */ iterator begin () { @@ -133,6 +142,12 @@ public: { return m_args.empty (); } + + /* Clear the argument vector. */ + void clear () + { + free_vector_argv (m_args); + } }; } /* namespac gdb */ |