aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/config/utility.hxx11
-rw-r--r--libbuild2/config/utility.txx4
2 files changed, 9 insertions, 6 deletions
diff --git a/libbuild2/config/utility.hxx b/libbuild2/config/utility.hxx
index b1995b6..cfb7177 100644
--- a/libbuild2/config/utility.hxx
+++ b/libbuild2/config/utility.hxx
@@ -43,7 +43,7 @@ namespace build2
pair<lookup, bool>
required (scope& root,
const variable&,
- const T& default_value,
+ T&& default_value,
bool override = false,
uint64_t save_flags = 0);
@@ -53,12 +53,15 @@ namespace build2
inline pair<lookup, bool>
required (scope& root,
const string& name,
- const T& default_value,
+ T&& default_value,
bool override = false,
uint64_t save_flags = 0)
{
- return required (
- root, root.ctx.var_pool[name], default_value, override, save_flags);
+ return required (root,
+ root.ctx.var_pool[name],
+ std::forward<T> (default_value), // VC14
+ override,
+ save_flags);
}
inline pair<lookup, bool>
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.