diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-08 09:24:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-02-13 12:42:42 +0200 |
commit | 8aee78c8d0eb06334571e596f6fbdf7ed5756f0c (patch) | |
tree | 12899b0b09c8fcbaf3a1064b28db8f6161003cbe /build2/target | |
parent | 5cefca444f7062c61cc9d118ffea5901e05186fd (diff) |
Tighten target constness further
Diffstat (limited to 'build2/target')
-rw-r--r-- | build2/target | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/build2/target b/build2/target index 90aaeec..6cc492a 100644 --- a/build2/target +++ b/build2/target @@ -250,7 +250,7 @@ namespace build2 // resolve_group_members() from <build2/algorithm>. // virtual group_view - group_members (action_type) const; + group_members (action_type); // Note that the returned key "tracks" the target (except for the // extension). @@ -475,9 +475,11 @@ namespace build2 // // Currenly the data is not destroyed until the next match. // - static constexpr size_t data_size = sizeof (string) * 4; - std::aligned_storage<data_size>::type data_pad; - void (*data_dtor) (void*) = nullptr; + // Note that the recipe may modify (mutable) the data. + // + static constexpr size_t data_size = sizeof (string) * 4; + mutable std::aligned_storage<data_size>::type data_pad; + mutable void (*data_dtor) (void*) = nullptr; template <typename R, typename T = typename std::remove_cv< @@ -503,14 +505,10 @@ namespace build2 template <typename T> T& - data () {return *reinterpret_cast<T*> (&data_pad);} - - template <typename T> - const T& - data () const {return *reinterpret_cast<const T*> (&data_pad);} + data () const {return *reinterpret_cast<T*> (&data_pad);} void - clear_data () + clear_data () const { if (data_dtor != nullptr) { |