ned14 / outcome

Provides very lightweight outcome<T> and result<T> (non-Boost edition)
https://ned14.github.io/outcome
Other
704 stars 62 forks source link

Example doesn't compile #256

Closed J-Roux closed 2 years ago

J-Roux commented 3 years ago

https://github.com/boostorg/outcome/blob/master/doc/src/snippets/using_outcome.cpp

https://godbolt.org/z/K3qb1xKKj

ned14 commented 3 years ago

If you replace the problem std items with boost, it works. See https://godbolt.org/z/ensfo4jEY.

As to why boost::exception_ptr won't accept a std::exception_ptr, I CC in @zajo to see if he can tell us.

J-Roux commented 3 years ago

Thank you. But in this way docs are still incorrect.

ned14 commented 3 years ago

Depends on your definition of "incorrect". Outcome has always been clear that it comes in standalone and Boost flavours, and the defaulted template parameters are the only thing which varies between the two. Most users of either understand this and adapt the examples appropriately.

J-Roux commented 3 years ago

I read this example in boost docs(https://www.boost.org/doc/libs/1_77_0/libs/outcome/doc/html/tutorial/essential/outcome.html). And I expected that example in boost docs are compilable. I think it is a common sense.

ned14 commented 3 years ago

@zajo

zajo commented 3 years ago

Try with current develop. Note, you need both the throw_exception and exception repos.

ned14 commented 2 years ago

Cool thanks Emil. I'm going to go ahead and close this now, but thanks for raising the issue.