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-20 12:50:45 -05:00
2018-12-06 09:06:13 -05:00
2018-11-28 14:27:22 -05:00
2018-11-28 08:56:00 -05:00
2018-11-20 14:16:26 -05:00
2018-11-28 09:07:45 -05:00
2018-12-12 08:10:15 -05:00
2018-12-11 13:19:39 -05:00
2018-12-11 13:19:39 -05:00
2018-11-03 08:39:45 -04:00
2018-11-03 08:39:45 -04:00
2018-11-06 21:43:33 +03:00
2018-11-20 10:36:08 -05:00
2018-12-12 08:10:15 -05:00
2018-12-06 00:01:03 -05:00
2018-11-06 21:43:33 +03:00
2018-11-19 23:35:09 +01:00
2018-11-22 00:11:37 +01:00
2018-11-06 21:43:33 +03:00
2018-11-27 16:20:43 -05:00
2018-10-30 11:01:36 -04:00
2018-10-26 09:25:51 -04:00
2018-11-09 10:38:07 -05:00
2018-11-19 10:11:12 -05:00
2018-12-01 17:56:23 +01:00
2018-11-28 09:07:45 -05:00
2018-11-19 23:35:09 +01:00
2018-11-03 08:39:45 -04:00
2018-11-20 10:36:08 -05:00
2018-11-19 23:35:09 +01:00
2018-11-20 10:36:08 -05:00
2018-11-22 00:11:37 +01:00
2018-11-22 00:11:37 +01:00
2018-11-06 21:43:33 +03:00
2018-11-28 09:05:16 -05:00
2018-11-27 08:50:36 +00:00
2018-11-01 07:25:17 -04:00
2018-11-06 21:43:33 +03:00
2018-11-06 21:43:33 +03:00
2018-11-14 15:05:06 -05:00
2018-11-14 15:05:06 -05:00
2018-11-20 10:36:08 -05:00
2018-11-08 14:58:57 +01:00
2018-11-08 14:58:57 +01:00
2018-11-19 17:02:06 -05:00
2018-11-20 10:36:08 -05:00
2018-11-11 17:34:09 +01:00
2018-11-06 21:43:33 +03:00
2018-11-22 00:11:37 +01:00
2018-11-22 00:11:37 +01:00
2018-11-26 13:42:50 -05:00
2018-11-01 07:36:39 -04:00
2018-10-25 07:32:26 -04:00
2018-11-27 13:20:34 -05:00
2018-11-11 17:34:09 +01:00
2018-10-26 11:17:49 -04:00
2018-10-26 11:17:49 -04:00
2018-11-20 10:36:08 -05:00
2018-11-07 14:08:48 -05:00
2018-11-07 14:08:48 -05:00
2018-11-22 00:11:37 +01:00
2018-11-07 14:08:48 -05:00
2018-11-22 00:11:37 +01:00
2018-10-29 11:57:29 -04:00
2018-11-06 21:43:33 +03:00
2018-10-26 06:54:32 -04:00
2018-10-26 06:54:32 -04:00
2018-11-11 17:34:09 +01:00
2018-11-11 17:34:09 +01:00
2018-11-22 00:11:37 +01:00
2018-11-22 00:11:37 +01:00
2018-11-06 21:43:33 +03:00
2018-11-19 23:35:09 +01:00
2018-11-20 10:36:08 -05:00
2018-11-14 15:05:06 -05:00
2018-12-05 14:45:19 -05:00
2018-11-22 00:11:37 +01:00
2018-12-06 08:39:22 -05:00
2018-11-06 21:43:33 +03:00
2018-11-22 00:11:37 +01:00
2018-11-06 21:43:33 +03:00
2018-11-19 17:02:06 -05:00
2018-11-28 13:07:27 +01:00
2018-11-11 14:28:55 +01:00
2018-11-11 14:28:55 +01:00
2018-12-06 09:05:22 -05:00
2018-11-19 23:35:09 +01:00
2018-11-22 00:11:37 +01:00
2018-11-06 21:43:33 +03:00
2018-11-22 00:11:37 +01:00
2018-11-22 00:11:37 +01:00
2018-11-06 21:43:33 +03:00
2018-11-06 21:43:33 +03:00
2018-10-30 11:01:36 -04:00
2018-12-12 08:10:16 -05:00
2018-12-12 08:10:16 -05:00
2018-11-06 21:43:33 +03:00
2018-11-28 14:27:22 -05:00
2018-11-28 14:27:22 -05:00
2018-11-06 21:43:33 +03:00
2018-11-22 00:11:37 +01:00
2018-10-26 12:09:41 -04:00
2018-12-01 17:56:23 +01:00
2018-12-06 08:39:22 -05:00
2018-11-06 21:43:33 +03:00
2018-11-10 11:06:37 +08:00
2018-11-27 07:13:26 +02:00
2018-11-27 07:13:26 +02:00
2018-11-20 10:36:08 -05:00
2018-11-27 13:20:34 -05:00