diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-11-22 14:51:57 -0500 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-11-22 15:36:18 -0500 |
| commit | 10fea99d8049d3224f736bcfaa1cf981fa0d14ec (patch) | |
| tree | 5799f43318c210696cc7e1f284e59c30e7cfe578 /Source/Core | |
| parent | ddf8abf507c40eb5e038297a87d2881a1d33d05c (diff) | |
InputCommon/FunctionExpression: Make MakeFunctionExpression() take a std::string_view
There's nothing within this function that requires a copy of the string
to be made, so we can make use of a non-owning view
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/InputCommon/ControlReference/FunctionExpression.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/InputCommon/ControlReference/FunctionExpression.h | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp b/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp index ae3f14097e..abc6eece02 100644 --- a/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp +++ b/Source/Core/InputCommon/ControlReference/FunctionExpression.cpp @@ -447,7 +447,7 @@ private: mutable Clock::time_point m_release_time = Clock::now(); }; -std::unique_ptr<FunctionExpression> MakeFunctionExpression(std::string name) +std::unique_ptr<FunctionExpression> MakeFunctionExpression(std::string_view name) { if ("not" == name) return std::make_unique<NotExpression>(); diff --git a/Source/Core/InputCommon/ControlReference/FunctionExpression.h b/Source/Core/InputCommon/ControlReference/FunctionExpression.h index 44d9092ce9..e247d9a623 100644 --- a/Source/Core/InputCommon/ControlReference/FunctionExpression.h +++ b/Source/Core/InputCommon/ControlReference/FunctionExpression.h @@ -6,6 +6,7 @@ #include <memory> #include <string> +#include <string_view> #include <variant> #include <vector> @@ -47,6 +48,6 @@ private: std::vector<std::unique_ptr<Expression>> m_args; }; -std::unique_ptr<FunctionExpression> MakeFunctionExpression(std::string name); +std::unique_ptr<FunctionExpression> MakeFunctionExpression(std::string_view name); } // namespace ciface::ExpressionParser |
