diff --git a/index.html b/index.html
index 77cf8bcb..3d97473e 100644
--- a/index.html
+++ b/index.html
@@ -1923,7 +1923,7 @@
Transporting Errors Between Threads With Exception Ha
-Follow this link to see a complete example program: try_capture_all_eh.cpp.
+Follow this link to see a complete example program: try_capture_all_exceptions.cpp.
|
@@ -2494,7 +2494,7 @@ Using error_monitor
to Re
-When using Lua with C++, we need to protect the Lua interpreter from exceptions that may be thrown from C++ functions installed as lua_CFunction callbacks. Here is the program from this section rewritten to use a C++ exception (instead of leaf::result ) to safely communicate errors out of the do_work function: lua_callback_eh.cpp.
+When using Lua with C++, we need to protect the Lua interpreter from exceptions that may be thrown from C++ functions installed as lua_CFunction callbacks. Here is the program from this section rewritten to use a C++ exception (instead of leaf::result ) to safely communicate errors out of the do_work function: lua_callback_exceptions.cpp.
|
diff --git a/leaf.hpp b/leaf.hpp
index 5661e770..951c1633 100644
--- a/leaf.hpp
+++ b/leaf.hpp
@@ -2,7 +2,7 @@
#define BOOST_LEAF_HPP_INCLUDED
// Boost LEAF single header distribution. Do not edit.
-// Generated on Sep 15, 2024 from https://github.com/boostorg/leaf/tree/7bd20a5.
+// Generated on Sep 28, 2024 from https://github.com/boostorg/leaf/tree/c973cd4.
// Latest published version of this file: https://raw.githubusercontent.com/boostorg/leaf/gh-pages/leaf.hpp.
@@ -891,7 +891,7 @@ struct BOOST_LEAF_SYMBOL_VISIBLE e_file_name
struct BOOST_LEAF_SYMBOL_VISIBLE e_file_name
{
- constexpr static char const * const value = "";
+ char const * value = "";
BOOST_LEAF_CONSTEXPR explicit e_file_name( char const * ) { }
};
@@ -2427,30 +2427,30 @@ namespace detail
namespace detail
{
- class leaf_category final: public std::error_category
+ class leaf_error_category final: public std::error_category
{
bool equivalent( int, std::error_condition const & ) const noexcept final override { return false; }
bool equivalent( std::error_code const &, int ) const noexcept final override { return false; }
char const * name() const noexcept final override { return "LEAF error"; }
std::string message( int ) const final override { return name(); }
public:
- ~leaf_category() noexcept final override { }
+ ~leaf_error_category() noexcept final override { }
};
template
- struct get_error_category
+ struct get_leaf_error_category
{
- static leaf_category cat;
+ static leaf_error_category cat;
};
template
- leaf_category get_error_category::cat;
+ leaf_error_category get_leaf_error_category::cat;
inline int import_error_code( std::error_code const & ec ) noexcept
{
if( int err_id = ec.value() )
{
- std::error_category const & cat = get_error_category<>::cat;
+ std::error_category const & cat = get_leaf_error_category<>::cat;
if( &ec.category() == &cat )
{
BOOST_LEAF_ASSERT((err_id&3) == 1);
@@ -2470,7 +2470,7 @@ namespace detail
inline bool is_error_id( std::error_code const & ec ) noexcept
{
- bool res = (&ec.category() == &detail::get_error_category<>::cat);
+ bool res = (&ec.category() == &detail::get_leaf_error_category<>::cat);
BOOST_LEAF_ASSERT(!res || !ec.value() || ((ec.value()&3) == 1));
return res;
}
@@ -2504,21 +2504,22 @@ class BOOST_LEAF_SYMBOL_VISIBLE error_id
}
#if BOOST_LEAF_CFG_STD_SYSTEM_ERROR
- error_id( std::error_code const & ec ) noexcept:
- value_(detail::import_error_code(ec))
+ explicit error_id( std::error_code const & ec ) noexcept:
+ value_(detail::import_error_code(std::error_code(ec)))
{
BOOST_LEAF_ASSERT(!value_ || ((value_&3) == 1));
}
template
- error_id( Enum e, typename std::enable_if::value, Enum>::type * = 0 ) noexcept:
+ error_id( Enum e, typename std::enable_if::value, int>::type = 0 ) noexcept:
value_(detail::import_error_code(e))
{
}
- operator std::error_code() const noexcept
+ template ::value, int>::type = 0>
+ operator T() const noexcept
{
- return std::error_code(value_, detail::get_error_category<>::cat);
+ return std::error_code(value_, detail::get_leaf_error_category<>::cat);
}
#endif
@@ -3624,7 +3625,7 @@ try_handle_all( TryBlock && try_block, H && ... h ) noexcept
else
{
detail::unload_result(&r);
- error_id id = r.error();
+ error_id id(r.error());
ctx.deactivate();
using R = typename std::decay()().value())>::type;
return ctx.template handle_error(std::move(id), std::forward(h)...);
@@ -3644,12 +3645,12 @@ try_handle_some( TryBlock && try_block, H && ... h ) noexcept
else
{
detail::unload_result(&r);
- error_id id = r.error();
+ error_id id(r.error());
ctx.deactivate();
using R = typename std::decay()())>::type;
auto rr = ctx.template handle_error(std::move(id), std::forward(h)..., [&r]()->R { return std::move(r); });
if( !rr )
- ctx.unload(rr.error());
+ ctx.unload(error_id(rr.error()));
return rr;
}
}
@@ -3679,7 +3680,7 @@ namespace detail
{
auto r = std::forward(try_block)();
unload_result(&r);
- return std::move(r);
+ return r;
}
catch( std::exception & ex )
{
@@ -3720,7 +3721,7 @@ try_handle_all( TryBlock && try_block, H && ... h )
{
BOOST_LEAF_ASSERT(ctx.is_active());
detail::unload_result(&r);
- error_id id = r.error();
+ error_id id(r.error());
ctx.deactivate();
using R = typename std::decay()().value())>::type;
return ctx.template handle_error(std::move(id), std::forward(h)...);
@@ -3740,7 +3741,7 @@ try_handle_some( TryBlock && try_block, H && ... h )
else if( ctx.is_active() )
{
detail::unload_result(&r);
- error_id id = r.error();
+ error_id id(r.error());
ctx.deactivate();
using R = typename std::decay()())>::type;
auto rr = ctx.template handle_error(std::move(id), std::forward(h)...,
@@ -3749,12 +3750,12 @@ try_handle_some( TryBlock && try_block, H && ... h )
return std::move(r);
});
if( !rr )
- ctx.unload(rr.error());
+ ctx.unload(error_id(rr.error()));
return rr;
}
else
{
- ctx.unload(r.error());
+ ctx.unload(error_id(r.error()));
return r;
}
}
@@ -4544,7 +4545,7 @@ exception_to_result( F && f ) noexcept
} }
#endif // BOOST_LEAF_EXCEPTION_HPP_INCLUDED
-// #include // Expanded at line 3098
+// #include // Expanded at line 3099
// >>> #include
#ifndef BOOST_LEAF_ON_ERROR_HPP_INCLUDED
#define BOOST_LEAF_ON_ERROR_HPP_INCLUDED
@@ -4781,7 +4782,7 @@ on_error( Item && ... i )
// #line 8 "boost/leaf/pred.hpp"
// #include // Expanded at line 14
-// #include // Expanded at line 3098
+// #include // Expanded at line 3099
#if __cplusplus >= 201703L
# define BOOST_LEAF_MATCH_ARGS(et,v1,v) auto v1, auto... v
@@ -5077,7 +5078,7 @@ struct is_predicate>: std::true_type
// #include // Expanded at line 14
// #include // Expanded at line 1582
// #include // Expanded at line 1576
-// #include // Expanded at line 4264
+// #include // Expanded at line 4265
#include
#include
@@ -5297,10 +5298,12 @@ class BOOST_LEAF_SYMBOL_VISIBLE BOOST_LEAF_ATTRIBUTE_NODISCARD result
}
}
- operator error_id() noexcept
+ operator error_id() const noexcept
{
result_discriminant const what = r_.what_;
- return what.kind() == result_discriminant::val? error_id() : what.get_error_id();
+ return what.kind() == result_discriminant::val?
+ error_id() :
+ what.get_error_id();
}
};
@@ -5802,8 +5805,8 @@ struct is_result_type>: std::true_type
#if __cplusplus >= 201703L
// #include // Expanded at line 14
-// #include // Expanded at line 3098
-// #include // Expanded at line 5073
+// #include // Expanded at line 3099
+// #include // Expanded at line 5074
#include
#include
#include
diff --git a/leaf.pdf b/leaf.pdf
index 2075ca3b..008b1c2e 100644
Binary files a/leaf.pdf and b/leaf.pdf differ