TartanLlama / optional

C++11/14/17 std::optional with functional-style extensions and reference support
https://tl.tartanllama.xyz
Creative Commons Zero v1.0 Universal
859 stars 67 forks source link

Support optional references #3

Closed TartanLlama closed 6 years ago

TartanLlama commented 6 years ago

tl::optional now supports references:

int i = 42;
tl::optional<int&> o = i;
*o == 42; //true
i = 12;
*o = 12; //true
&*o == &i; //true

Assignment has rebind semantics:

int j = 8;
o = j;

&*o == &j; //true