aboutsummaryrefslogtreecommitdiff
path: root/build2/target-key
diff options
context:
space:
mode:
Diffstat (limited to 'build2/target-key')
-rw-r--r--build2/target-key9
1 files changed, 5 insertions, 4 deletions
diff --git a/build2/target-key b/build2/target-key
index f0ea80b..7905f8a 100644
--- a/build2/target-key
+++ b/build2/target-key
@@ -26,7 +26,9 @@ namespace build2
const dir_path* const dir; // Can be relative if part of prerequisite_key.
const dir_path* const out; // Can be relative if part of prerequisite_key.
const string* const name;
- const string* const& ext;
+ const optional<string>& ext;
+
+ static const optional<string> nullext;
template <typename T>
bool is_a () const {return type->is_a<T> ();}
@@ -47,15 +49,14 @@ namespace build2
inline bool
operator== (const target_key& x, const target_key& y)
{
- // Unspecified and specified extension are assumed equal. The extension
- // strings are from the pool, so we can just compare pointers.
+ // Unspecified and specified extension are assumed equal.
//
return
x.type == y.type &&
*x.dir == *y.dir &&
*x.out == *y.out &&
*x.name == *y.name &&
- (x.ext == nullptr || y.ext == nullptr || x.ext == y.ext);
+ (!x.ext || !y.ext || *x.ext == *y.ext);
}
inline bool