Skip to content

Commit

Permalink
Deploying to gh-pages from @ 031dfa0 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Jan 9, 2024
1 parent f70beec commit 2b1a7da
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 17 deletions.
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5463,7 +5463,7 @@ <h4 id="error_id::load"><code>load</code></h4>
<div class="ulist">
<ul>
<li>
<p>If <code>value()==0</code>, all of <code>item&#8230;&#8203;</code> are discarded and no further action is taken.</p>
<p>If <code>this->value()==0</code>, all of <code>item&#8230;&#8203;</code> are discarded and no further action is taken.</p>
</li>
<li>
<p>Otherwise, what happens with each <code>item</code> depends on its type:</p>
Expand All @@ -5473,7 +5473,7 @@ <h4 id="error_id::load"><code>load</code></h4>
<p>If it is a function that takes a single argument of some type <code>E &amp;</code>, that function is called with the object of type <code>E</code> currently associated with <code>*this</code>. If no such object exists, a default-initialized object is associated with <code>*this</code> and then passed to the function.</p>
</li>
<li>
<p>If it is a function that takes no arguments, than function is called to obtain an error object, which is associated with <code>*this</code>.</p>
<p>If it is a function that takes no arguments, that function is called to obtain an error object which is associated with <code>*this</code>, except in the special case of a <code>void</code> function, in which case it is invoked and no error object is obtained/loaded.</p>
</li>
<li>
<p>Otherwise, the <code>item</code> itself is assumed to be an error object, which is associated with <code>*this</code>.</p>
Expand Down
66 changes: 51 additions & 15 deletions leaf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

// LEAF single header distribution. Do not edit.

// Generated on 01/08/2024 from https://github.com/boostorg/leaf/tree/668049c.
// Generated on 01/09/2024 from https://github.com/boostorg/leaf/tree/031dfa0.
// Latest version of this file: https://raw.githubusercontent.com/boostorg/leaf/gh-pages/leaf.hpp.

// Copyright 2018-2023 Emil Dotchevski and Reverge Studios, Inc.
Expand Down Expand Up @@ -2262,7 +2262,7 @@ namespace leaf_detail
}

template <bool OnError, class E, class F>
inline void dynamic_accumulate( int err_id, F && f ) noexcept(OnError)
inline void dynamic_load_accumulate( int err_id, F && f ) noexcept(OnError)
{
if( OnError )
{
Expand Down Expand Up @@ -2310,9 +2310,9 @@ namespace leaf_detail
template <bool OnError, class E>
BOOST_LEAF_CONSTEXPR inline int load_slot( int err_id, E && e ) noexcept(OnError)
{
static_assert(!std::is_pointer<E>::value, "Error objects of pointer types are not allowed");
static_assert(!std::is_same<typename std::decay<E>::type, error_id>::value, "Error objects of type error_id are not allowed");
using T = typename std::decay<E>::type;
static_assert(!std::is_pointer<E>::value, "Error objects of pointer types are not allowed");
static_assert(!std::is_same<T, error_id>::value, "Error objects of type error_id are not allowed");
BOOST_LEAF_ASSERT((err_id&3)==1);
if( slot<T> * p = tls::read_ptr<slot<T>>() )
{
Expand All @@ -2327,7 +2327,27 @@ namespace leaf_detail
}

template <bool OnError, class F>
BOOST_LEAF_CONSTEXPR inline int accumulate_slot( int err_id, F && f ) noexcept(OnError)
BOOST_LEAF_CONSTEXPR inline int load_slot_deferred( int err_id, F && f ) noexcept(OnError)
{
using E = typename function_traits<F>::return_type;
using T = typename std::decay<E>::type;
static_assert(!std::is_pointer<E>::value, "Error objects of pointer types are not allowed");
static_assert(!std::is_same<T, error_id>::value, "Error objects of type error_id are not allowed");
BOOST_LEAF_ASSERT((err_id&3)==1);
if( slot<T> * p = tls::read_ptr<slot<T>>() )
{
if( !OnError || !p->has_value(err_id) )
(void) p->load(err_id, std::forward<F>(f)());
}
#if BOOST_LEAF_CFG_CAPTURE
else
dynamic_load<OnError>(err_id, std::forward<F>(f)());
#endif
return 0;
}

template <bool OnError, class F>
BOOST_LEAF_CONSTEXPR inline int load_slot_accumulate( int err_id, F && f ) noexcept(OnError)
{
static_assert(function_traits<F>::arity==1, "Lambdas passed to accumulate must take a single e-type argument by reference");
using E = typename std::decay<fn_arg_type<F,0>>::type;
Expand All @@ -2342,7 +2362,7 @@ namespace leaf_detail
}
#if BOOST_LEAF_CFG_CAPTURE
else
dynamic_accumulate<OnError, E>(err_id, std::forward<F>(f));
dynamic_load_accumulate<OnError, E>(err_id, std::forward<F>(f));
#endif
return 0;
}
Expand Down Expand Up @@ -2376,7 +2396,7 @@ namespace leaf_detail
{
BOOST_LEAF_CONSTEXPR static int load_( int err_id, F && f ) noexcept
{
return load_slot<false>(err_id, std::forward<F>(f)());
return load_slot_deferred<false>(err_id, std::forward<F>(f));
}
};

Expand All @@ -2385,7 +2405,7 @@ namespace leaf_detail
{
BOOST_LEAF_CONSTEXPR static int load_( int err_id, F && f ) noexcept
{
return accumulate_slot<false>(err_id, std::forward<F>(f));
return load_slot_accumulate<false>(err_id, std::forward<F>(f));
}
};
}
Expand Down Expand Up @@ -4762,10 +4782,9 @@ namespace leaf_detail
}
};

template <class F>
template <class F, class ReturnType = typename function_traits<F>::return_type>
class deferred_item
{
using E = decltype(std::declval<F>()());
F f_;

public:
Expand All @@ -4777,7 +4796,25 @@ namespace leaf_detail

BOOST_LEAF_CONSTEXPR void trigger( int err_id ) noexcept
{
(void) load_slot<true>(err_id, f_());
(void) load_slot_deferred<true>(err_id, f_);
}
};

template <class F>
class deferred_item<F, void>
{
F f_;

public:

BOOST_LEAF_CONSTEXPR deferred_item( F && f ) noexcept:
f_(std::forward<F>(f))
{
}

BOOST_LEAF_CONSTEXPR void trigger( int ) noexcept
{
f_();
}
};

Expand All @@ -4787,7 +4824,6 @@ namespace leaf_detail
template <class F, class A0>
class accumulating_item<F, A0 &, 1>
{
using E = A0;
F f_;

public:
Expand All @@ -4799,7 +4835,7 @@ namespace leaf_detail

BOOST_LEAF_CONSTEXPR void trigger( int err_id ) noexcept
{
accumulate_slot<true>(err_id, std::move(f_));
load_slot_accumulate<true>(err_id, std::move(f_));
}
};

Expand Down Expand Up @@ -5182,7 +5218,7 @@ struct is_predicate<catch_<Ex...>>: std::true_type
// Expanded at line 16: #include <boost/leaf/config.hpp>
// Expanded at line 1490: #include <boost/leaf/detail/print.hpp>
// Expanded at line 1362: #include <boost/leaf/detail/capture_list.hpp>
// Expanded at line 4370: #include <boost/leaf/exception.hpp>
// Expanded at line 4390: #include <boost/leaf/exception.hpp>

#include <climits>
#include <functional>
Expand Down Expand Up @@ -5902,7 +5938,7 @@ struct is_result_type<result<T>>: std::true_type

// Expanded at line 16: #include <boost/leaf/config.hpp>
// Expanded at line 731: #include <boost/leaf/handle_errors.hpp>
// Expanded at line 5174: #include <boost/leaf/result.hpp>
// Expanded at line 5210: #include <boost/leaf/result.hpp>
#include <variant>
#include <optional>
#include <tuple>
Expand Down
Binary file modified leaf.pdf
Binary file not shown.

0 comments on commit 2b1a7da

Please sign in to comment.