1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-10 16:21:40 +08:00
Brad King 2d68b2c593 String: Add str_if_stable() as a const alternative to str()
The `str()` method must be non-const because it may need to internally
mutate the representation of the string in order to have an owned
`std::string` instance holding the exact string (not a superstring).
This is inconvenient in contexts where we can ensure that no mutation
is needed to get a `std::string const&`.

Add a `str_if_stable() const` method that returns `std::string const*`
so we can return `nullptr` if if mutation would be necessary to get a
`std::string const&`.  Add supporting `is_stable() const` and
`stabilize()` methods to check and enforce stable availability of
`std::string const&`.  These can be used to create `String const`
instances from which we can still get a `std::string const&` via
`*str_if_stable()` by maintaining the stability invariant at runtime.
2018-12-12 08:10:16 -05:00
..
2018-11-28 14:27:22 -05:00
2018-12-06 00:01:03 -05:00
2018-11-19 23:35:09 +01:00
2018-11-19 23:35:09 +01:00
2018-11-19 23:35:09 +01:00
2018-11-28 09:05:16 -05:00
2018-11-27 08:50:36 +00:00
2018-11-19 23:35:09 +01:00