diff options
author | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-10-07 22:03:56 +0200 |
---|---|---|
committer | Johannes Stoelp <johannes.stoelp@gmail.com> | 2024-10-07 22:03:56 +0200 |
commit | 3f62112e3a1b180a9b931d6f43b3cdc74e7ba3b9 (patch) | |
tree | a8201bf501f2c9690e51109d8be31c2fb4af7e4a /test/option.cc | |
parent | af7a61a5464c266426a20e7dacf6c52bb80b28e9 (diff) | |
download | cpp-utils-3f62112e3a1b180a9b931d6f43b3cdc74e7ba3b9.tar.gz cpp-utils-3f62112e3a1b180a9b931d6f43b3cdc74e7ba3b9.zip |
Diffstat (limited to 'test/option.cc')
-rw-r--r-- | test/option.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/option.cc b/test/option.cc index 09c0fdf..4aa08a1 100644 --- a/test/option.cc +++ b/test/option.cc @@ -61,6 +61,18 @@ int main() { assert(!o2.has_value()); assert(o4.has_value()); + option<checker> o5; + // copy assign + o5 = o4; + assert(o4.has_value()); + assert(o5.has_value()); + + option<checker> o6; + // move assign + o6 = std::move(o5); + assert(!o5.has_value()); + assert(o6.has_value()); + // take reference to inner auto x = o3.value(); // take ownership of inner |