-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dlib::optional #2815
dlib::optional #2815
Conversation
more tests
It's ready. I think it's a good addition |
Sweet, I'll look in a bit :D |
@davisking Have you had a chance to look at this ? |
Sorry, not yet. Haven't forgotten though 😅 |
I quite like the |
Yeah, depends on how heavy handed you want the implementation to be. Like if every call to any of these functions spawned a new thread that just waited on the future(s) to be ready that's easy. But something less heavyweight gets tricky fast. |
This is real nice. I just spent nearly 2 hours reading it all over and trying to find problems but couldn't find any. Thought I saw a bug at one point but was wrong :) Thanks for the awesome PR. |
This is work in progress.
This is inspired by Sy Brand's tl::optional repo and https://github.com/bitwizeshift/BackportCpp.git
I've tried a few different ways of doing things. For example, i didn't like using
union
but it turns out you can't usealigned_storage
if you want things to be constexpr and direct initialization to work.I have to say, this is an education in C++ initialization. It's laughable how complicated an object that is either active or None can be. C++ is so messed up. And yet, I love it