The skstd::optional already does this correctly, but it appears to be
one of the guarantees of this class which isn't tested.
Change-Id: Iedd9004496f10c1ec56da4ebc5e246880c9a457f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/467781
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Add full compliment of operator*, have them assert in debug,
but not throw in release as per c++ spec.
Add full compliment of value() have them crash if there is
no value as per the c++ spec.
Add value_or.
Add test for value_or.
Change-Id: Ib0d9a01fba367768e66d00fbc61b471397e8582c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/425476
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This involves a significant number of overloads, as optionals can be
compared against other optionals, or nullopt, or a value; either side
can mix and match as desired.
Change-Id: I26b8420e417300d32569fc76a55bcfd8e01eb322
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/420576
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
This adds copy constructors / assignment operator, reset(), value(), and
has_value() to SkTOptional.
Change-Id: I564552a75a4c612685cdaa8e80e4359b394b64a4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/414338
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This is needed by the upcoming DSLParser.
Change-Id: I54a0714e55feeb78894df766b14c795970f2c2d4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411308
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>