aboutsummaryrefslogtreecommitdiff
path: root/build/variable
diff options
context:
space:
mode:
Diffstat (limited to 'build/variable')
-rw-r--r--build/variable47
1 files changed, 25 insertions, 22 deletions
diff --git a/build/variable b/build/variable
index 0cd411d..42f0787 100644
--- a/build/variable
+++ b/build/variable
@@ -14,9 +14,10 @@
#include <typeindex>
#include <unordered_set>
+#include <butl/prefix-map>
+
#include <build/path>
#include <build/name>
-#include <build/prefix-map>
namespace build
{
@@ -207,24 +208,10 @@ namespace std
};
}
-namespace build
+namespace butl
{
- // variable_pool
- //
- struct variable_set: std::unordered_set<variable>
- {
- // @@ Need to check/set type?
- //
- const variable&
- find (std::string name) {return *emplace (std::move (name)).first;}
- };
-
- extern variable_set variable_pool;
-
- // variable_map
- //
template <>
- struct compare_prefix<variable_cref>: compare_prefix<std::string>
+ struct compare_prefix<build::variable_cref>: compare_prefix<std::string>
{
typedef compare_prefix<std::string> base;
@@ -232,22 +219,38 @@ namespace build
compare_prefix (char d): base (d) {}
bool
- operator() (const variable& x, const variable& y) const
+ operator() (const build::variable& x, const build::variable& y) const
{
return base::operator() (x.name, y.name);
}
bool
- prefix (const variable& p, const variable& k) const
+ prefix (const build::variable& p, const build::variable& k) const
{
return base::prefix (p.name, k.name);
}
};
+}
- struct variable_map: prefix_map<variable_cref, value_ptr, '.'>
+namespace build
+{
+ // variable_pool
+ //
+ struct variable_set: std::unordered_set<variable>
{
- typedef prefix_map<variable_cref, value_ptr, '.'> base;
+ // @@ Need to check/set type?
+ //
+ const variable&
+ find (std::string name) {return *emplace (std::move (name)).first;}
+ };
+
+ extern variable_set variable_pool;
+ // variable_map
+ //
+ using variable_map_base = butl::prefix_map<variable_cref, value_ptr, '.'>;
+ struct variable_map: variable_map_base
+ {
value_proxy
operator[] (const variable& var) const
{
@@ -268,7 +271,7 @@ namespace build
value_proxy
assign (const variable& var)
{
- return value_proxy (&base::operator[] (var), this);
+ return value_proxy (&variable_map_base::operator[] (var), this);
}
value_proxy