From 8aee78c8d0eb06334571e596f6fbdf7ed5756f0c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 8 Feb 2017 09:24:07 +0200 Subject: Tighten target constness further --- build2/target | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'build2/target') 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 . // 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::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::type data_pad; + mutable void (*data_dtor) (void*) = nullptr; template T& - data () {return *reinterpret_cast (&data_pad);} - - template - const T& - data () const {return *reinterpret_cast (&data_pad);} + data () const {return *reinterpret_cast (&data_pad);} void - clear_data () + clear_data () const { if (data_dtor != nullptr) { -- cgit v1.1