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

Removing direct value access #30

Open juxeii opened 5 years ago

juxeii commented 5 years ago

Hi, I wonder what would be the fastest way on removing the error-prone * and -> operators for direct value access? Towards a more monadic implementation I do not want the users accessing these public and unsafe operators. Would it make sense to declare all the non-class templates as friends to the optional class? I'm not an expert in library design and your implementation is way beyond my abilities...

Thx Juergen

TartanLlama commented 5 years ago

Probably easiest to remove those functions from the source and run the tests to find any places they were called, then replacing those sites with direct accesses by making the non-members friend functions like you say.

juxeii commented 5 years ago

For now I go with a subtype approach and see if I can delete the unsafe operations.