Feat/286/std expected - #340
Conversation
…oth c++23 and c++20 implementation
…aving the correct boolean flag
…error value initialization semantics
|
Hi @jowillianto, Thanks for the PR. I look forward to having this in the library. However, the tests fail to compile. Should be an easy fix, though. Could you take a look? |
|
I will try my best to fix these for linux and macos first. My main machine is a macbook pro. In the end, if I cannot fix for windows, please help me. |
|
@jowillianto , I will take a look tonight |
|
@jowillianto, the tests and benchmarks now compile and run through. |
|
Thanks. I was setting up environments. |
|
So what should we do now? @liuzicheng1987 |
|
@jowillianto, I think there are two more things to do:
|
|
I think running the tests by compiling it in both cpp23 and cpp20 should serve the purpose. Additionally, I think we should compile while projects in the same cpp version otherwise linking errors or what I experience is everything works but incorrect behaviour. |
|
@jowillianto , I dug a bit deeper and found that a lot of the weird compilation and runtime errors we have been getting is that the compiler was mixing the old result type with std::expected. Because a "Result" wasn't the same across different compilation units we were getting all kinds of weird errors. I have found that designing it as an explicit opt-in resolves at least some of the issues. |
|
@jowillianto, you said your main machine is a MacBook Pro. I wonder, how did you compile it? I cannot get this to compile with Clang. It appears they don't fully support std::expected yet, so now I only test for GCC. |
|
@liuzicheng1987 |
|
@jowillianto , I can compile the library and the tests locally using Clang-19 without any issues. The tests pass. However, the Github Actions build pipeline does not seem to be ready for Clang-19 quite yet. That being said, I think this is ready to be merged. Do you agree? Thank you so much for contributing this. |
|
I will look at this one last time tomorrow. I'll leave a comment when I am done. :) |
…cxx23) and REFLECTCPP_USE_STD_EXPECTED=OFF(cxx20). This allows compilation even for projects that does not specify CXX version
|
I added a version switch for CXX20 and CXX23 in CMakeLists.txt because it apparently does not compile without specifying any options. @liuzicheng1987. Otherwise, the tests should have covered most of the things. |
|
@jowillianto, I see...I actually updated all relevant parts of the documentation to explicitly include definitions of the standard: I think this is probably the better solution anyway, because it allows people to specify the standard they want. But your solution is good as well. Should I revert the relevant changes to the documentation or should we simply revert your last commit? |
|
@jowillianto, another solution would be something of the order "If the standard is not explicitly defined by the user, then use 20 or 23." |
|
This should be good to go now ! |
|
I'll just wait for the tests to run through, just as a matter of formality, and then I will merge. |
|
@jowillianto , thank you so much for your contribution. |
|
@jowillianto , sorry, fat fingers... |
|
Likewise, it is a good experience working with repository this big. This is probably my first time. However, I really like the modern functional-style design principles. I hope more C++ code can have such modern design principles. |
No description provided.