From 16e0cac7c964bfa5a81f5fa6da170c3e24b031b1 Mon Sep 17 00:00:00 2001 From: zajo Date: Fri, 26 Jul 2024 21:58:12 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20boostorg?= =?UTF-8?q?/leaf@5a621a8f754ea34da23ed2eaf381d831b3673812=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 2 +- leaf.hpp | 117 ++++++++++++++++++++++++++++++++++------------------- leaf.pdf | 16 ++++---- 3 files changed, 85 insertions(+), 50 deletions(-) diff --git a/index.html b/index.html index ca3db29..0897ddf 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ - + LEAF diff --git a/leaf.hpp b/leaf.hpp index 5cbca44..b92ff92 100644 --- a/leaf.hpp +++ b/leaf.hpp @@ -3,7 +3,7 @@ // LEAF single header distribution. Do not edit. -// Generated on 01/28/2024 from https://github.com/boostorg/leaf/tree/ed8f9cd. +// Generated on 07/26/2024 from https://github.com/boostorg/leaf/tree/5a621a8. // Latest version of this file: https://raw.githubusercontent.com/boostorg/leaf/gh-pages/leaf.hpp. // Copyright 2018-2023 Emil Dotchevski and Reverge Studios, Inc. @@ -897,6 +897,16 @@ namespace leaf_detail return value_; } + BOOST_LEAF_CONSTEXPR T const * has_value() const noexcept + { + return key_ ? &value_ : nullptr; + } + + BOOST_LEAF_CONSTEXPR T * has_value() noexcept + { + return key_ ? &value_ : nullptr; + } + BOOST_LEAF_CONSTEXPR T const * has_value(int key) const noexcept { BOOST_LEAF_ASSERT(key); @@ -1909,6 +1919,11 @@ namespace leaf_detail BOOST_LEAF_ASSERT(x.prev_==nullptr); } + ~slot() noexcept + { + BOOST_LEAF_ASSERT(tls::read_ptr>() != this); + } + void activate() noexcept { prev_ = tls::read_ptr>(); @@ -2038,7 +2053,7 @@ namespace leaf_detail public: - explicit capturing_exception_node( capture_list::node * * & last, std::exception_ptr && ex ) noexcept: + capturing_exception_node( capture_list::node * * & last, std::exception_ptr && ex ) noexcept: capturing_node(last), ex_(std::move(ex)) { @@ -2048,14 +2063,12 @@ namespace leaf_detail }; #endif - int err_id_; node * * last_; public: dynamic_allocator() noexcept: capture_list(nullptr), - err_id_(0), last_(&first_) { BOOST_LEAF_ASSERT(first_ == nullptr); @@ -2063,7 +2076,6 @@ namespace leaf_detail dynamic_allocator( dynamic_allocator && other ) noexcept: capture_list(std::move(other)), - err_id_(other.err_id_), last_(other.last_ == &other.first_? &first_ : other.last_) { BOOST_LEAF_ASSERT(last_ != nullptr); @@ -2072,17 +2084,6 @@ namespace leaf_detail other.last_ = &other.first_; } - void append( dynamic_allocator && other ) noexcept - { - if( node * other_first = other.first_ ) - { - *last_ = other_first; - last_ = other.last_; - other.first_ = nullptr; - other.last_ = &other.first_; - } - } - template typename std::decay::type & dynamic_load(int err_id, E && e) { @@ -2092,7 +2093,6 @@ namespace leaf_detail BOOST_LEAF_ASSERT(tls::read_ptr>() == nullptr); capturing_slot_node * csn = new capturing_slot_node(last_, err_id, std::forward(e)); csn->activate(); - err_id_ = err_id; return csn->value(err_id); } @@ -2106,7 +2106,7 @@ namespace leaf_detail } template - LeafResult extract_capture_list() noexcept + LeafResult extract_capture_list(int err_id) noexcept { #ifndef BOOST_LEAF_NO_EXCEPTIONS if( std::exception_ptr ex = std::current_exception() ) @@ -2115,9 +2115,10 @@ namespace leaf_detail leaf_detail::capture_list::node * const f = first_; first_ = nullptr; last_ = &first_; - return { err_id_, capture_list(f) }; + return { err_id, capture_list(f) }; } + using capture_list::unload; using capture_list::print; }; @@ -2135,9 +2136,8 @@ namespace leaf_detail template <> inline void slot::deactivate() const noexcept { - if( int const err_id = this->key() ) - if( dynamic_allocator const * c = this->has_value(err_id) ) - c->deactivate(); + if( dynamic_allocator const * c = this->has_value() ) + c->deactivate(); tls::write_ptr>(prev_); } @@ -2145,12 +2145,8 @@ namespace leaf_detail inline void slot::unload( int err_id ) noexcept(false) { BOOST_LEAF_ASSERT(err_id); - if( dynamic_allocator * da1 = this->has_value(err_id) ) - if( impl * p = tls::read_ptr>() ) - if( dynamic_allocator * da2 = p->has_value(err_id) ) - da2->append(std::move(*da1)); - else - *p = std::move(*this); + if( dynamic_allocator * da1 = this->has_value() ) + da1->unload(err_id); } template @@ -2158,7 +2154,7 @@ namespace leaf_detail { if( slot * sl = tls::read_ptr>() ) { - if( dynamic_allocator * c = sl->has_value(err_id) ) + if( dynamic_allocator * c = sl->has_value() ) c->dynamic_load(err_id, std::forward(e)); else sl->load(err_id).dynamic_load(err_id, std::forward(e)); @@ -2233,7 +2229,10 @@ namespace leaf_detail if( this->key()!=err_id ) return; if( impl * p = tls::read_ptr>() ) - *p = std::move(*this); + { + if( !p->has_value(err_id) ) + *p = std::move(*this); + } #if BOOST_LEAF_CFG_CAPTURE else dynamic_load(err_id, std::move(*this).value(err_id)); @@ -3258,6 +3257,36 @@ protected: namespace leaf_detail { + template + struct get_dispatch + { + static BOOST_LEAF_CONSTEXPR T const * get(T const * x) noexcept + { + return x; + } + static BOOST_LEAF_CONSTEXPR T const * get(void const *) noexcept + { + return nullptr; + } + }; + + template + BOOST_LEAF_CONSTEXPR inline typename std::enable_if::type const * + find_in_tuple(std::tuple const & t) noexcept + { + return get_dispatch::get(&std::get(t)); + } + + template + BOOST_LEAF_CONSTEXPR inline typename std::enable_if::type const * + find_in_tuple(std::tuple const & t) noexcept + { + if( T const * x = get_dispatch::get(&std::get(t)) ) + return x; + else + return find_in_tuple(t); + } + struct verbose_diagnostic_info_: verbose_diagnostic_info { template @@ -3273,7 +3302,8 @@ namespace leaf_detail template BOOST_LEAF_CONSTEXPR static verbose_diagnostic_info_ get( Tup const & tup, error_info const & ei ) noexcept { - return verbose_diagnostic_info_(ei, tup, handler_argument_traits_defaults::check(tup, ei)); + slot const * da = find_in_tuple>(tup); + return verbose_diagnostic_info_(ei, tup, da ? da->has_value() : nullptr ); } }; } @@ -3977,19 +4007,22 @@ namespace leaf_detail else { sl.deactivate(); - return leaf_result(sl.value(error_id(r.error()).value()).template extract_capture_list()); + int const err_id = error_id(r.error()).value(); + return leaf_result(sl.value(err_id).template extract_capture_list(err_id)); } } #ifndef BOOST_LEAF_NO_EXCEPTIONS catch( std::exception & ex ) { sl.deactivate(); - return sl.value(error_info(&ex).error().value()).template extract_capture_list(); + int const err_id = error_info(&ex).error().value(); + return sl.value(err_id).template extract_capture_list(err_id); } catch(...) { sl.deactivate(); - return sl.value(error_info(nullptr).error().value()).template extract_capture_list(); + int const err_id = error_info(nullptr).error().value(); + return sl.value(err_id).template extract_capture_list(err_id); } #endif } @@ -4034,12 +4067,14 @@ namespace leaf_detail catch( std::exception & ex ) { sl.deactivate(); - return sl.value(error_info(&ex).error().value()).template extract_capture_list(); + int const err_id = error_info(&ex).error().value(); + return sl.value(err_id).template extract_capture_list(err_id); } catch(...) { sl.deactivate(); - return sl.value(error_info(nullptr).error().value()).template extract_capture_list(); + int const err_id = error_info(nullptr).error().value(); + return sl.value(err_id).template extract_capture_list(err_id); } #endif } @@ -4244,7 +4279,7 @@ future_get( Future & fut ) // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Expanded at line 16: #include -// Expanded at line 1501: #include +// Expanded at line 1511: #include #include #include @@ -5178,9 +5213,9 @@ struct is_predicate>: std::true_type // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Expanded at line 16: #include -// Expanded at line 1490: #include -// Expanded at line 1362: #include -// Expanded at line 4356: #include +// Expanded at line 1500: #include +// Expanded at line 1372: #include +// Expanded at line 4391: #include #include #include @@ -5924,7 +5959,7 @@ struct is_result_type>: std::true_type // Expanded at line 16: #include // Expanded at line 731: #include -// Expanded at line 5172: #include +// Expanded at line 5207: #include #include #include #include diff --git a/leaf.pdf b/leaf.pdf index 8eaa3d0..4ef9fd3 100644 --- a/leaf.pdf +++ b/leaf.pdf @@ -3,10 +3,10 @@ 1 0 obj << /Title (LEAF) /Author (Lightweight Error Augmentation Framework written in C++11 | Emil Dotchevski) -/Creator (Asciidoctor PDF 2.3.11, based on Prawn 2.4.0) -/Producer (Lightweight Error Augmentation Framework written in C++11 | Emil Dotchevski) -/ModDate (D:20240128201548+00'00') -/CreationDate (D:20240128201620+00'00') +/Creator (Lightweight Error Augmentation Framework written in C++11 | Emil Dotchevski) +/Producer (Asciidoctor PDF 2.3.17, based on Prawn 2.4.0) +/ModDate (D:20240726215719+00'00') +/CreationDate (D:20240726215759+00'00') >> endobj 2 0 obj @@ -301869,7 +301869,7 @@ endobj << /Type /FontDescriptor /FontName /e0e61a+NotoSerif /FontFile2 1013 0 R -/FontBBox [-212 -250 1246 1047] +/FontBBox [-518 -250 1246 1047] /Flags 6 /StemV 0 /ItalicAngle 0 @@ -301943,7 +301943,7 @@ endobj << /Type /FontDescriptor /FontName /771d15+NotoSerif-Bold /FontFile2 1017 0 R -/FontBBox [-212 -250 1306 1058] +/FontBBox [-555 -250 1306 1058] /Flags 6 /StemV 0 /ItalicAngle 0 @@ -302202,7 +302202,7 @@ endobj << /Type /FontDescriptor /FontName /065c67+NotoSerif-Italic /FontFile2 1037 0 R -/FontBBox [-254 -250 1238 1047] +/FontBBox [-421 -250 1238 1047] /Flags 70 /StemV 0 /ItalicAngle -12 @@ -302298,7 +302298,7 @@ endobj << /Type /FontDescriptor /FontName /b1eed4+NotoSerif /FontFile2 1045 0 R -/FontBBox [-212 -250 1246 1047] +/FontBBox [-518 -250 1246 1047] /Flags 6 /StemV 0 /ItalicAngle 0