Comments (2)
Thank you for your reply.
I was referring to the object that is returned if no error arises.
Please refer to this example on Compiler Explorer: https://godbolt.org/z/7nefnxnrv.
With throwing_foo
there are no copies being made thanks to prvalue materialization rules.
With noexcept_foo
, which returns a leaf::result
, one copy takes place.
If it was possible to initialize leaf::result directly with the T constructor parameters the copy would not happen.
from leaf.
You do this by invoking new_error, which does take a parameter pack:
result<int> f()
{
if( .... )
return leaf::new_error(e1, e2, ...);
}
Note that in LEAF result<> types never hold any error objects, so moving an object of a result<> type is efficient even when e1, e2, ... are extremely expensive to move.
from leaf.
Related Issues (20)
- explicit conversion constructor called implicitly in result<T> -> result<U> conversion HOT 1
- Better documentation of the core mechanism HOT 9
- exception() requires an rvalue-reference for its exception parameter. HOT 2
- No error_id loaded when catching an non-leaf::exception HOT 15
- Documentation unclear on how to test the error-returning functions HOT 4
- Question: How to correctly rethrow/propagate? HOT 3
- How to catch objects from upper levels of class hierarchy? HOT 8
- BOOST_LEAF_CFG_CAPTURE must be 1 for single-header build to compile HOT 6
- Add leaf to the Conan Center Index HOT 3
- Failing to use leaf with Conan and CMake HOT 4
- new_error not throw error from error_handler HOT 3
- Dead PDF doc link HOT 1
- FEATURE: Store all error objects when verbose_diagnostic_info is in try_handle_all handlers HOT 10
- Should leaf::result be [[nodiscard]]? HOT 4
- Should leaf::result::value_type be public? HOT 2
- Should LEAF provide allocating context for simple multi-thread error handling? HOT 4
- Slightly modified exception_error_log example does not produce expected output HOT 3
- Few best practice questions HOT 5
- Modular Boost C++ Libraries Request HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaf.