aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/config/utility.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-10-18 08:37:27 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-10-18 09:36:55 +0200
commita566a3acc84386e4738711d27a250f63e59cbb6b (patch)
tree472fc3526d8207d0842f75305e803205cbfb578d /libbuild2/config/utility.txx
parent75d9644c125006170e773d7bf9372c4d9676e7a1 (diff)
Optimize config::required() to move default value if possible
Diffstat (limited to 'libbuild2/config/utility.txx')
-rw-r--r--libbuild2/config/utility.txx4
1 files changed, 2 insertions, 2 deletions
diff --git a/libbuild2/config/utility.txx b/libbuild2/config/utility.txx
index 9c1455f..4c4e305 100644
--- a/libbuild2/config/utility.txx
+++ b/libbuild2/config/utility.txx
@@ -13,7 +13,7 @@ namespace build2
pair<lookup, bool>
required (scope& root,
const variable& var,
- const T& def_val,
+ T&& def_val,
bool def_ovr,
uint64_t save_flags)
{
@@ -35,7 +35,7 @@ namespace build2
//
if (!l.defined () || (def_ovr && !l.belongs (root)))
{
- value& v (root.assign (var) = def_val);
+ value& v (root.assign (var) = std::forward<T> (def_val)); // VC14
v.extra = true; // Default value flag.
n = (save_flags & save_commented) == 0; // Absence means default.