/work/workdir/UnpackedTarball/harfbuzz/src/hb-result.hh
Line | Count | Source |
1 | | /* |
2 | | * Copyright © 2025 Google, Inc. |
3 | | * |
4 | | * This is part of HarfBuzz, a text shaping library. |
5 | | * |
6 | | * Permission is hereby granted, without written agreement and without |
7 | | * license or royalty fees, to use, copy, modify, and distribute this |
8 | | * software and its documentation for any purpose, provided that the |
9 | | * above copyright notice and the following two paragraphs appear in |
10 | | * all copies of this software. |
11 | | * |
12 | | * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
13 | | * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
14 | | * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
15 | | * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
16 | | * DAMAGE. |
17 | | * |
18 | | * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
19 | | * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
20 | | * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
21 | | * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
22 | | * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
23 | | * |
24 | | * Google Author(s): Garret Rieger |
25 | | */ |
26 | | |
27 | | #ifndef HB_RESULT_HH |
28 | | #define HB_RESULT_HH |
29 | | |
30 | | #include "hb.hh" |
31 | | |
32 | | // Helper structs for Ok(...) and Err(...), not used directly |
33 | | // by users of hb_result_t. |
34 | | template <typename T> |
35 | | struct hb_result_ok_t |
36 | | { |
37 | | T value; |
38 | | }; |
39 | | |
40 | | template <> |
41 | | struct hb_result_ok_t<void> {}; |
42 | | |
43 | | template <typename E> |
44 | | struct hb_result_err_t |
45 | | { |
46 | | E error; |
47 | | |
48 | | template <typename OtherE> |
49 | | constexpr bool operator == (const hb_result_err_t<OtherE>& other) const { return error == other.error; } |
50 | | template <typename OtherE> |
51 | | constexpr bool operator != (const hb_result_err_t<OtherE>& other) const { return error != other.error; } |
52 | | }; |
53 | | |
54 | | template <typename X> struct _hb_is_result_tag : hb_false_type {}; |
55 | | template <typename X> struct _hb_is_result_tag<hb_result_ok_t<X>> : hb_true_type {}; |
56 | | template <typename X> struct _hb_is_result_tag<hb_result_err_t<X>> : hb_true_type {}; |
57 | | |
58 | | template <typename T> |
59 | | static inline constexpr hb_result_ok_t<T&&> Ok (T&& v) |
60 | 0 | { |
61 | 0 | return hb_result_ok_t<T&&>{std::forward<T> (v)}; |
62 | 0 | } Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<hb_blob_t*&&> Ok<hb_blob_t*>(hb_blob_t*&&) Unexecuted instantiation: hb-subset.cc:hb_result_ok_t<hb_blob_t*&> Ok<hb_blob_t*&>(hb_blob_t*&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<hb_blob_t*&&> Ok<hb_blob_t*>(hb_blob_t*&&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_ok_t<hb_blob_t*&> Ok<hb_blob_t*&>(hb_blob_t*&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<hb_blob_t*&&> Ok<hb_blob_t*>(hb_blob_t*&&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_ok_t<hb_blob_t*&> Ok<hb_blob_t*&>(hb_blob_t*&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<hb_blob_t*&&> Ok<hb_blob_t*>(hb_blob_t*&&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_ok_t<hb_blob_t*&> Ok<hb_blob_t*&>(hb_blob_t*&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<hb_blob_t*&&> Ok<hb_blob_t*>(hb_blob_t*&&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_ok_t<hb_blob_t*&> Ok<hb_blob_t*&>(hb_blob_t*&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<hb_blob_t*&&> Ok<hb_blob_t*>(hb_blob_t*&&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_ok_t<hb_blob_t*&> Ok<hb_blob_t*&>(hb_blob_t*&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<unsigned int const&> Ok<unsigned int const&>(unsigned int const&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<unsigned int&> Ok<unsigned int&>(unsigned int&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<bool&&> Ok<bool>(bool&&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<unsigned long&> Ok<unsigned long&>(unsigned long&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<bool&> Ok<bool&>(bool&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&> Ok<hb_vector_t<unsigned int, false>&>(hb_vector_t<unsigned int, false>&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<unsigned long&&> Ok<unsigned long>(unsigned long&&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<hb_vector_t<unsigned int, false>&&> Ok<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false>&&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<hb_pair_t<unsigned int&, graph::LigatureSet*&>&&> Ok<hb_pair_t<unsigned int&, graph::LigatureSet*&> >(hb_pair_t<unsigned int&, graph::LigatureSet*&>&&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_ok_t<hb_hashmap_t<unsigned int, unsigned int, false>&> Ok<hb_hashmap_t<unsigned int, unsigned int, false>&>(hb_hashmap_t<unsigned int, unsigned int, false>&) |
63 | | |
64 | | static inline constexpr hb_result_ok_t<void> Ok () |
65 | 0 | { |
66 | 0 | return hb_result_ok_t<void>{}; |
67 | 0 | } Unexecuted instantiation: hb-subset.cc:Ok() Unexecuted instantiation: hb-subset-table-layout.cc:Ok() Unexecuted instantiation: hb-subset-table-var.cc:Ok() Unexecuted instantiation: hb-subset-table-cff.cc:Ok() Unexecuted instantiation: hb-subset-table-color.cc:Ok() Unexecuted instantiation: hb-subset-table-other.cc:Ok() Unexecuted instantiation: gsubgpos-context.cc:Ok() |
68 | | |
69 | | template <typename E> |
70 | | static inline constexpr hb_result_err_t<E&&> Err (E&& e) |
71 | 0 | { |
72 | 0 | return hb_result_err_t<E&&>{std::forward<E> (e)}; |
73 | 0 | } Unexecuted instantiation: hb-subset.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: hb-subset.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: hb-subset-table-layout.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: hb-subset-table-var.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: hb-subset-table-cff.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: hb-subset-table-color.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: hb-subset-table-other.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_err_t<graph::graph_error_t&&> Err<graph::graph_error_t>(graph::graph_error_t&&) Unexecuted instantiation: gsubgpos-context.cc:hb_result_err_t<graph::graph_error_t&> Err<graph::graph_error_t&>(graph::graph_error_t&) |
74 | | |
75 | | template <typename T, typename E> |
76 | | struct HB_NODISCARD_STRUCT hb_result_t |
77 | | { |
78 | | private: |
79 | | union |
80 | | { |
81 | | T val_; |
82 | | E err_; |
83 | | }; |
84 | | bool is_ok_; |
85 | | |
86 | | void destroy () |
87 | 0 | { |
88 | 0 | if (is_ok_) |
89 | 0 | val_.~T (); |
90 | 0 | else |
91 | 0 | err_.~E (); |
92 | 0 | } Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<unsigned long, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::ClassDef, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::class_def_size_estimator_t, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::ClassDef const*, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::Coverage const*, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<hb_vector_t<graph::MarkBasePosFormat1::class_info_t, false>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<hb_pair_t<unsigned int, graph::LigatureSet*>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::gsubgpos_graph_context_t, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<bool, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<hb_blob_t*, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::graph_t, graph::graph_error_t>::destroy() Unexecuted instantiation: hb_result_t<graph::GSTAR const*, graph::graph_error_t>::destroy() |
93 | | |
94 | | void init(const hb_result_t& o) { |
95 | | is_ok_ = o.is_ok_; |
96 | | if (is_ok_) |
97 | | new (std::addressof (val_)) T (o.val_); |
98 | | else |
99 | | new (std::addressof (err_)) E (o.err_); |
100 | | } |
101 | | |
102 | 0 | void init(hb_result_t&& o) { |
103 | 0 | is_ok_ = o.is_ok_; |
104 | 0 | if (is_ok_) |
105 | 0 | new (std::addressof (val_)) T (std::move (o.val_)); |
106 | 0 | else |
107 | 0 | new (std::addressof (err_)) E (std::move (o.err_)); |
108 | 0 | } |
109 | | |
110 | | public: |
111 | | ~hb_result_t () |
112 | 0 | { |
113 | 0 | destroy (); |
114 | 0 | } Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<unsigned long, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::ClassDef, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::class_def_size_estimator_t, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::ClassDef const*, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::Coverage const*, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<hb_vector_t<graph::MarkBasePosFormat1::class_info_t, false>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<hb_pair_t<unsigned int, graph::LigatureSet*>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::gsubgpos_graph_context_t, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<bool, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<hb_blob_t*, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::graph_t, graph::graph_error_t>::~hb_result_t() Unexecuted instantiation: hb_result_t<graph::GSTAR const*, graph::graph_error_t>::~hb_result_t() |
115 | | |
116 | | hb_result_t () = delete; |
117 | | |
118 | | hb_result_t (const hb_result_t& o) : is_ok_ (false) |
119 | | { |
120 | | init (o); |
121 | | } |
122 | | |
123 | | hb_result_t (hb_result_t&& o) noexcept (std::is_nothrow_move_constructible<T>::value && |
124 | | std::is_nothrow_move_constructible<E>::value) |
125 | | : is_ok_ (false) |
126 | | { |
127 | | init (std::move (o)); |
128 | | } |
129 | | |
130 | | hb_result_t& operator = (const hb_result_t& o) |
131 | | { |
132 | | if (this == &o) return *this; |
133 | | if (is_ok_ && o.is_ok_) |
134 | | { |
135 | | val_ = o.val_; |
136 | | } |
137 | | else if (!is_ok_ && !o.is_ok_) |
138 | | { |
139 | | err_ = o.err_; |
140 | | } |
141 | | else |
142 | | { |
143 | | destroy (); |
144 | | init (o); |
145 | | } |
146 | | return *this; |
147 | | } |
148 | | |
149 | | hb_result_t& operator = (hb_result_t&& o) noexcept (std::is_nothrow_move_assignable<T>::value && |
150 | | std::is_nothrow_move_assignable<E>::value) |
151 | 0 | { |
152 | 0 | if (this == &o) return *this; |
153 | 0 | if (is_ok_ && o.is_ok_) |
154 | 0 | { |
155 | 0 | val_ = std::move (o.val_); |
156 | 0 | } |
157 | 0 | else if (!is_ok_ && !o.is_ok_) |
158 | 0 | { |
159 | 0 | err_ = std::move (o.err_); |
160 | 0 | } |
161 | 0 | else |
162 | 0 | { |
163 | 0 | destroy (); |
164 | 0 | init (std::move (o)); |
165 | 0 | } |
166 | 0 | return *this; |
167 | 0 | } |
168 | | |
169 | | // Construct from Ok(...) tag |
170 | | template <typename U, |
171 | | hb_enable_if ((std::is_constructible<T, U>::value))> |
172 | 0 | hb_result_t (hb_result_ok_t<U>&& o) : is_ok_ (true) |
173 | 0 | { |
174 | 0 | new (std::addressof (val_)) T (std::move (o.value)); |
175 | 0 | } Unexecuted instantiation: _ZN11hb_result_tIbN5graph13graph_error_tEEC2IObTnPN12hb_enable_ifIXsr3std16is_constructibleIbT_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIjN5graph13graph_error_tEEC2IRjTnPN12hb_enable_ifIXsr3std16is_constructibleIjT_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIjN5graph13graph_error_tEEC2IRKjTnPN12hb_enable_ifIXsr3std16is_constructibleIjT_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS7_E Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIjLb0EEN5graph13graph_error_tEEC2IOS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS8_E Unexecuted instantiation: _ZN11hb_result_tImN5graph13graph_error_tEEC2IRmTnPN12hb_enable_ifIXsr3std16is_constructibleImT_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS6_E Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIjLb0EEN5graph13graph_error_tEEC2IRS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS8_E Unexecuted instantiation: _ZN11hb_result_tIjN5graph13graph_error_tEEC2IOmTnPN12hb_enable_ifIXsr3std16is_constructibleIjT_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS6_E Unexecuted instantiation: _ZN11hb_result_tI12hb_hashmap_tIjjLb0EEN5graph13graph_error_tEEC2IRS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS8_E Unexecuted instantiation: _ZN11hb_result_tI9hb_pair_tIjPN5graph11LigatureSetEENS1_13graph_error_tEEC2IOS0_IRjRS3_ETnPN12hb_enable_ifIXsr3std16is_constructibleIS4_T_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tISD_E Unexecuted instantiation: _ZN11hb_result_tIbN5graph13graph_error_tEEC2IRbTnPN12hb_enable_ifIXsr3std16is_constructibleIbT_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIP9hb_blob_tN5graph13graph_error_tEEC2IOS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS8_E Unexecuted instantiation: _ZN11hb_result_tIP9hb_blob_tN5graph13graph_error_tEEC2IRS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO14hb_result_ok_tIS8_E |
176 | | |
177 | | template <typename U, |
178 | | hb_enable_if ((std::is_constructible<T, const U&>::value))> |
179 | | hb_result_t (const hb_result_ok_t<U>& o) : is_ok_ (true) |
180 | | { |
181 | | new (std::addressof (val_)) T (o.value); |
182 | | } |
183 | | |
184 | | // Construct from Err(...) tag |
185 | | template <typename F, |
186 | | hb_enable_if ((std::is_constructible<E, F>::value))> |
187 | 0 | hb_result_t (hb_result_err_t<F>&& e) : is_ok_ (false) |
188 | 0 | { |
189 | 0 | new (std::addressof (err_)) E (std::move (e.error)); |
190 | 0 | } Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_tENS0_13graph_error_tEEC2IOS2_TnPN12hb_enable_ifIXsr3std16is_constructibleIS2_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS7_E Unexecuted instantiation: _ZN11hb_result_tIbN5graph13graph_error_tEEC2IOS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIjN5graph13graph_error_tEEC2IOS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIjN5graph13graph_error_tEEC2IRS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS6_E Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIjLb0EEN5graph13graph_error_tEEC2IOS3_TnPN12hb_enable_ifIXsr3std16is_constructibleIS3_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS8_E Unexecuted instantiation: _ZN11hb_result_tImN5graph13graph_error_tEEC2IOS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_8CoverageELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tIPKN5graph8CoverageENS0_13graph_error_tEEC2IOS4_TnPN12hb_enable_ifIXsr3std16is_constructibleIS4_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS9_E Unexecuted instantiation: _ZN11hb_result_tIPKN5graph8ClassDefENS0_13graph_error_tEEC2IOS4_TnPN12hb_enable_ifIXsr3std16is_constructibleIS4_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS9_E Unexecuted instantiation: _ZN11hb_result_tIN5graph26class_def_size_estimator_tENS0_13graph_error_tEEC2IOS2_TnPN12hb_enable_ifIXsr3std16is_constructibleIS2_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS7_E Unexecuted instantiation: _ZN11hb_result_tI12hb_hashmap_tIjjLb0EEN5graph13graph_error_tEEC2IRS3_TnPN12hb_enable_ifIXsr3std16is_constructibleIS3_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS8_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_8ClassDefELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIN5graph18MarkBasePosFormat112class_info_tELb0EENS1_13graph_error_tEEC2IOS5_TnPN12hb_enable_ifIXsr3std16is_constructibleIS5_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISA_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_9MarkArrayELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_12AnchorMatrixELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_8CoverageELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_9MarkArrayELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_12AnchorMatrixELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_11LigatureSetELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIjLb0EEN5graph13graph_error_tEEC2IRS3_TnPN12hb_enable_ifIXsr3std16is_constructibleIS3_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS8_E Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_11LigatureSetELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IOS6_TnPN12hb_enable_ifIXsr3std16is_constructibleIS6_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISB_E Unexecuted instantiation: _ZN11hb_result_tI9hb_pair_tIjPN5graph11LigatureSetEENS1_13graph_error_tEEC2IOS5_TnPN12hb_enable_ifIXsr3std16is_constructibleIS5_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tISA_E Unexecuted instantiation: _ZN11hb_result_tIP9hb_blob_tN5graph13graph_error_tEEC2IOS3_TnPN12hb_enable_ifIXsr3std16is_constructibleIS3_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS8_E Unexecuted instantiation: _ZN11hb_result_tIPKN5graph5GSTARENS0_13graph_error_tEEC2IOS4_TnPN12hb_enable_ifIXsr3std16is_constructibleIS4_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS9_E Unexecuted instantiation: _ZN11hb_result_tIN5graph24gsubgpos_graph_context_tENS0_13graph_error_tEEC2IOS2_TnPN12hb_enable_ifIXsr3std16is_constructibleIS2_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS7_E |
191 | | |
192 | | template <typename F, |
193 | | hb_enable_if ((std::is_constructible<E, const F&>::value))> |
194 | | hb_result_t (const hb_result_err_t<F>& e) : is_ok_ (false) |
195 | | { |
196 | | new (std::addressof (err_)) E (e.error); |
197 | | } |
198 | | |
199 | | // Construct directly from error E (when neither T or E are convertible into each other) |
200 | | template <typename F = E, |
201 | | hb_enable_if ((hb_is_same (F, E) && |
202 | | !(hb_is_convertible (T, E) || hb_is_convertible (E, T))))> |
203 | | hb_result_t (F e) : is_ok_ (false) |
204 | | { |
205 | | new (std::addressof (err_)) E (std::move (e)); |
206 | | } |
207 | | |
208 | | // Construct directly from value T (when neither T or E are convertible into each other) |
209 | | template <typename U = T, |
210 | | hb_enable_if ((std::is_constructible<T, U>::value && |
211 | | !hb_is_same (hb_decay<U>, E) && |
212 | | !hb_is_same (hb_decay<U>, hb_result_t) && |
213 | | !_hb_is_result_tag<hb_decay<U>>::value && |
214 | | !(hb_is_convertible (T, E) || hb_is_convertible (E, T))))> |
215 | 0 | hb_result_t (U&& v) : is_ok_ (true) |
216 | 0 | { |
217 | 0 | new (std::addressof (val_)) T (std::forward<U> (v)); |
218 | 0 | } Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_tENS0_13graph_error_tEEC2IS1_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS1_T_EE5valuentsr10hb_is_sameINSt3__15decayIS6_E4typeES2_EE5valuentsr10hb_is_sameISA_S3_EE5valuentsr17_hb_is_result_tagISA_EE5valuentooL_ZNS7_17integral_constantIbLb0EE5valueEEL_ZNSC_5valueEEEvE4typeELPv0EEEOS6_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_8CoverageELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIPKN5graph8CoverageENS0_13graph_error_tEEC2IS3_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS3_T_EE5valuentsr10hb_is_sameINSt3__15decayIS8_E4typeES4_EE5valuentsr10hb_is_sameISC_S5_EE5valuentsr17_hb_is_result_tagISC_EE5valuentooL_ZNS9_17integral_constantIbLb0EE5valueEEL_ZNSE_5valueEEEvE4typeELPv0EEEOS8_ Unexecuted instantiation: _ZN11hb_result_tIPKN5graph8ClassDefENS0_13graph_error_tEEC2IS3_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS3_T_EE5valuentsr10hb_is_sameINSt3__15decayIS8_E4typeES4_EE5valuentsr10hb_is_sameISC_S5_EE5valuentsr17_hb_is_result_tagISC_EE5valuentooL_ZNS9_17integral_constantIbLb0EE5valueEEL_ZNSE_5valueEEEvE4typeELPv0EEEOS8_ Unexecuted instantiation: _ZN11hb_result_tIN5graph26class_def_size_estimator_tENS0_13graph_error_tEEC2IS1_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS1_T_EE5valuentsr10hb_is_sameINSt3__15decayIS6_E4typeES2_EE5valuentsr10hb_is_sameISA_S3_EE5valuentsr17_hb_is_result_tagISA_EE5valuentooL_ZNS7_17integral_constantIbLb0EE5valueEEL_ZNSC_5valueEEEvE4typeELPv0EEEOS6_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_8ClassDefELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIN5graph18MarkBasePosFormat112class_info_tELb0EENS1_13graph_error_tEEC2IS4_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS4_T_EE5valuentsr10hb_is_sameINSt3__15decayIS9_E4typeES5_EE5valuentsr10hb_is_sameISD_S6_EE5valuentsr17_hb_is_result_tagISD_EE5valuentooL_ZNSA_17integral_constantIbLb0EE5valueEEL_ZNSF_5valueEEEvE4typeELPv0EEEOS9_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_9MarkArrayELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_12AnchorMatrixELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_8CoverageELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_9MarkArrayELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_12AnchorMatrixELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_11LigatureSetELNS1_19vertex_mutability_tE0EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tI11hb_vector_tIjLb0EEN5graph13graph_error_tEEC2IS1_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS1_T_EE5valuentsr10hb_is_sameINSt3__15decayIS7_E4typeES3_EE5valuentsr10hb_is_sameISB_S4_EE5valuentsr17_hb_is_result_tagISB_EE5valuentooL_ZNS8_17integral_constantIbLb0EE5valueEEL_ZNSD_5valueEEEvE4typeELPv0EEEOS7_ Unexecuted instantiation: _ZN11hb_result_tIN5graph7graph_t18vertex_and_table_tINS0_11LigatureSetELNS1_19vertex_mutability_tE1EEENS0_13graph_error_tEEC2IS5_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS5_T_EE5valuentsr10hb_is_sameINSt3__15decayISA_E4typeES6_EE5valuentsr10hb_is_sameISE_S7_EE5valuentsr17_hb_is_result_tagISE_EE5valuentooL_ZNSB_17integral_constantIbLb0EE5valueEEL_ZNSG_5valueEEEvE4typeELPv0EEEOSA_ Unexecuted instantiation: _ZN11hb_result_tIPKN5graph5GSTARENS0_13graph_error_tEEC2IS3_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS3_T_EE5valuentsr10hb_is_sameINSt3__15decayIS8_E4typeES4_EE5valuentsr10hb_is_sameISC_S5_EE5valuentsr17_hb_is_result_tagISC_EE5valuentooL_ZNS9_17integral_constantIbLb0EE5valueEEL_ZNSE_5valueEEEvE4typeELPv0EEEOS8_ Unexecuted instantiation: _ZN11hb_result_tIN5graph24gsubgpos_graph_context_tENS0_13graph_error_tEEC2IS1_TnPN12hb_enable_ifIXaaaaaaaasr3std16is_constructibleIS1_T_EE5valuentsr10hb_is_sameINSt3__15decayIS6_E4typeES2_EE5valuentsr10hb_is_sameISA_S3_EE5valuentsr17_hb_is_result_tagISA_EE5valuentooL_ZNS7_17integral_constantIbLb0EE5valueEEL_ZNSC_5valueEEEvE4typeELPv0EEEOS6_ |
219 | | |
220 | | // Move fallible into a result if it's in_error() method returns false. |
221 | 0 | static hb_result_t from (T&& fallible, E error_value) { |
222 | 0 | if (fallible.in_error()) { |
223 | 0 | return Err(error_value); |
224 | 0 | } |
225 | 0 | return Ok(fallible); |
226 | 0 | } Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::from(hb_hashmap_t<unsigned int, unsigned int, false>&&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::from(hb_vector_t<unsigned int, false>&&, graph::graph_error_t) |
227 | | |
228 | 0 | bool is_ok () const { return is_ok_; }Unexecuted instantiation: hb_result_t<graph::graph_t, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<bool, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::Coverage const*, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::ClassDef const*, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::class_def_size_estimator_t, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::ClassDef, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<hb_vector_t<graph::MarkBasePosFormat1::class_info_t, false>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<hb_pair_t<unsigned int, graph::LigatureSet*>, graph::graph_error_t>::is_ok() const Unexecuted instantiation: hb_result_t<graph::GSTAR const*, graph::graph_error_t>::is_ok() const |
229 | 0 | bool is_err () const { return !is_ok_; }Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::is_err() const Unexecuted instantiation: hb_result_t<graph::gsubgpos_graph_context_t, graph::graph_error_t>::is_err() const Unexecuted instantiation: hb_result_t<hb_blob_t*, graph::graph_error_t>::is_err() const |
230 | | explicit operator bool () const { return is_ok (); } |
231 | | |
232 | 0 | T& value () & { assert (is_ok_); return val_; }Unexecuted instantiation: hb_result_t<graph::graph_t, graph::graph_error_t>::value() & Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::value() & Unexecuted instantiation: hb_result_t<graph::gsubgpos_graph_context_t, graph::graph_error_t>::value() & Unexecuted instantiation: hb_result_t<hb_blob_t*, graph::graph_error_t>::value() & |
233 | | const T& value () const & { assert (is_ok_); return val_; } |
234 | 0 | T value () && { assert (is_ok_); return std::move (val_); }Unexecuted instantiation: hb_result_t<bool, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::Coverage const*, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::ClassDef const*, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::class_def_size_estimator_t, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::ClassDef, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<hb_vector_t<graph::MarkBasePosFormat1::class_info_t, false>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<hb_pair_t<unsigned int, graph::LigatureSet*>, graph::graph_error_t>::value() && Unexecuted instantiation: hb_result_t<graph::GSTAR const*, graph::graph_error_t>::value() && |
235 | | |
236 | 0 | T& operator * () & { return value (); }Unexecuted instantiation: hb_result_t<graph::graph_t, graph::graph_error_t>::operator*() & Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::operator*() & Unexecuted instantiation: hb_result_t<graph::gsubgpos_graph_context_t, graph::graph_error_t>::operator*() & Unexecuted instantiation: hb_result_t<hb_blob_t*, graph::graph_error_t>::operator*() & |
237 | | const T& operator * () const & { return value (); } |
238 | 0 | T operator * () && { return std::move (*this).value (); }Unexecuted instantiation: hb_result_t<bool, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::Coverage const*, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::ClassDef const*, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::class_def_size_estimator_t, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::ClassDef, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<hb_vector_t<graph::MarkBasePosFormat1::class_info_t, false>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<hb_pair_t<unsigned int, graph::LigatureSet*>, graph::graph_error_t>::operator*() && Unexecuted instantiation: hb_result_t<graph::GSTAR const*, graph::graph_error_t>::operator*() && |
239 | | |
240 | | T* operator -> () { return std::addressof (value ()); } |
241 | | const T* operator -> () const { return std::addressof (value ()); } |
242 | | |
243 | | template <typename U> |
244 | | T value_or (U&& default_value) const & |
245 | | { |
246 | | if (is_ok_) return val_; |
247 | | return std::forward<U> (default_value); |
248 | | } |
249 | | |
250 | | template <typename U> |
251 | | T value_or (U&& default_value) && |
252 | 0 | { |
253 | 0 | if (is_ok_) return std::move (val_); |
254 | 0 | return std::forward<U> (default_value); |
255 | 0 | } |
256 | | |
257 | | T value_or_default () const & |
258 | | { |
259 | | if (is_ok_) return val_; |
260 | | return T (); |
261 | | } |
262 | | |
263 | | T value_or_default () && |
264 | | { |
265 | | if (is_ok_) return std::move (val_); |
266 | | return T (); |
267 | | } |
268 | | |
269 | | const E& error () const & { assert (!is_ok_); return err_; } |
270 | 0 | E& error () & { assert (!is_ok_); return err_; }Unexecuted instantiation: hb_result_t<graph::graph_t, graph::graph_error_t>::error() & Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::error() & Unexecuted instantiation: hb_result_t<graph::gsubgpos_graph_context_t, graph::graph_error_t>::error() & Unexecuted instantiation: hb_result_t<hb_blob_t*, graph::graph_error_t>::error() & |
271 | 0 | E error () && { assert (!is_ok_); return std::move (err_); }Unexecuted instantiation: hb_result_t<bool, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<unsigned int, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::Coverage const*, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::ClassDef const*, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::class_def_size_estimator_t, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<hb_hashmap_t<unsigned int, unsigned int, false>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::ClassDef, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<hb_vector_t<unsigned int, false>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<hb_vector_t<graph::MarkBasePosFormat1::class_info_t, false>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::Coverage, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::MarkArray, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::AnchorMatrix, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)0>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::graph_t::vertex_and_table_t<graph::LigatureSet, (graph::graph_t::vertex_mutability_t)1>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<hb_pair_t<unsigned int, graph::LigatureSet*>, graph::graph_error_t>::error() && Unexecuted instantiation: hb_result_t<graph::GSTAR const*, graph::graph_error_t>::error() && |
272 | | |
273 | | bool operator == (const hb_result_t& o) const |
274 | | { |
275 | | if (is_ok_ != o.is_ok_) return false; |
276 | | if (is_ok_) return val_ == o.val_; |
277 | | return err_ == o.err_; |
278 | | } |
279 | | |
280 | | bool operator != (const hb_result_t& o) const |
281 | | { |
282 | | return !(*this == o); |
283 | | } |
284 | | |
285 | | template <typename U> |
286 | | bool operator == (const hb_result_ok_t<U>& o) const |
287 | | { |
288 | | return is_ok_ && val_ == o.value; |
289 | | } |
290 | | |
291 | | template <typename U> |
292 | | bool operator != (const hb_result_ok_t<U>& o) const |
293 | | { |
294 | | return !(*this == o); |
295 | | } |
296 | | |
297 | | template <typename F> |
298 | | bool operator == (const hb_result_err_t<F>& e) const |
299 | | { |
300 | | return !is_ok_ && err_ == e.error; |
301 | | } |
302 | | |
303 | | template <typename F> |
304 | | bool operator != (const hb_result_err_t<F>& e) const |
305 | | { |
306 | | return !(*this == e); |
307 | | } |
308 | | |
309 | | template <typename U> |
310 | | bool operator == (const U&) const = delete; |
311 | | |
312 | | template <typename U> |
313 | | bool operator != (const U&) const = delete; |
314 | | }; |
315 | | |
316 | | // Partial specialization for void |
317 | | template <typename E> |
318 | | struct HB_NODISCARD_STRUCT hb_result_t<void, E> |
319 | | { |
320 | | private: |
321 | | union |
322 | | { |
323 | | E err_; |
324 | | }; |
325 | | bool is_ok_; |
326 | | |
327 | | template <typename, typename> friend struct hb_result_t; |
328 | | |
329 | | public: |
330 | | ~hb_result_t () |
331 | 0 | { |
332 | 0 | if (!is_ok_) |
333 | 0 | err_.~E (); |
334 | 0 | } |
335 | | |
336 | | hb_result_t () : is_ok_ (true) {} |
337 | 0 | hb_result_t (hb_result_ok_t<void>) : is_ok_ (true) {} |
338 | | |
339 | 0 | hb_result_t (const hb_result_t& o) : is_ok_ (o.is_ok_) |
340 | 0 | { |
341 | 0 | if (!is_ok_) |
342 | 0 | new (std::addressof (err_)) E (o.err_); |
343 | 0 | } |
344 | | |
345 | | hb_result_t (hb_result_t&& o) noexcept (std::is_nothrow_move_constructible<E>::value) |
346 | 0 | : is_ok_ (o.is_ok_) |
347 | 0 | { |
348 | 0 | if (!is_ok_) |
349 | 0 | new (std::addressof (err_)) E (std::move (o.err_)); |
350 | 0 | } |
351 | | |
352 | | hb_result_t& operator = (const hb_result_t& o) |
353 | | { |
354 | | if (this == &o) return *this; |
355 | | if (!is_ok_ && !o.is_ok_) |
356 | | { |
357 | | err_ = o.err_; |
358 | | } |
359 | | else if (!is_ok_ && o.is_ok_) |
360 | | { |
361 | | err_.~E (); |
362 | | is_ok_ = true; |
363 | | } |
364 | | else if (is_ok_ && !o.is_ok_) |
365 | | { |
366 | | new (std::addressof (err_)) E (o.err_); |
367 | | is_ok_ = false; |
368 | | } |
369 | | return *this; |
370 | | } |
371 | | |
372 | | hb_result_t& operator = (hb_result_t&& o) noexcept (std::is_nothrow_move_assignable<E>::value) |
373 | 0 | { |
374 | 0 | if (this == &o) return *this; |
375 | 0 | if (!is_ok_ && !o.is_ok_) |
376 | 0 | { |
377 | 0 | err_ = std::move (o.err_); |
378 | 0 | } |
379 | 0 | else if (!is_ok_ && o.is_ok_) |
380 | 0 | { |
381 | 0 | err_.~E (); |
382 | 0 | is_ok_ = true; |
383 | 0 | } |
384 | 0 | else if (is_ok_ && !o.is_ok_) |
385 | 0 | { |
386 | 0 | new (std::addressof (err_)) E (std::move (o.err_)); |
387 | 0 | is_ok_ = false; |
388 | 0 | } |
389 | 0 | return *this; |
390 | 0 | } |
391 | | |
392 | | template <typename F, |
393 | | hb_enable_if ((std::is_constructible<E, F>::value))> |
394 | 0 | hb_result_t (hb_result_err_t<F>&& e) : is_ok_ (false) |
395 | 0 | { |
396 | 0 | new (std::addressof (err_)) E (std::move (e.error)); |
397 | 0 | } Unexecuted instantiation: _ZN11hb_result_tIvN5graph13graph_error_tEEC2IRS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS6_E Unexecuted instantiation: _ZN11hb_result_tIvN5graph13graph_error_tEEC2IOS1_TnPN12hb_enable_ifIXsr3std16is_constructibleIS1_T_EE5valueEvE4typeELPv0EEEO15hb_result_err_tIS6_E |
398 | | |
399 | | template <typename F, |
400 | | hb_enable_if ((std::is_constructible<E, const F&>::value))> |
401 | | hb_result_t (const hb_result_err_t<F>& e) : is_ok_ (false) |
402 | | { |
403 | | new (std::addressof (err_)) E (e.error); |
404 | | } |
405 | | |
406 | | // Construct directly from error E |
407 | | hb_result_t (E e) : is_ok_ (false) |
408 | | { |
409 | | new (std::addressof (err_)) E (std::move(e)); |
410 | | } |
411 | | |
412 | | // V is any class which has an in_error() method. This checks the result |
413 | | // of in_error() and returns either Ok() or Err(error_value). |
414 | | template<typename V> |
415 | 0 | static hb_result_t<void, E> from (const V& fallible, E error_value) { |
416 | 0 | if (fallible.in_error()) { |
417 | 0 | return Err(error_value); |
418 | 0 | } |
419 | 0 | return Ok(); |
420 | 0 | } Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<unsigned int, false> >(hb_vector_t<unsigned int, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<graph::graph_t::vertex_t, false> >(hb_vector_t<graph::graph_t::vertex_t, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_set_t>(hb_set_t const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<bool, false> >(hb_vector_t<bool, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_priority_queue_t<long> >(hb_priority_queue_t<long> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_hashmap_t<graph::overflow_record_t, bool, false> >(hb_hashmap_t<graph::overflow_record_t, bool, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<graph::overflow_record_t, false> >(hb_vector_t<graph::overflow_record_t, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_map_t>(hb_map_t const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<char*, false> >(hb_vector_t<char*, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<hb_serialize_context_t::object_t::link_t, false> >(hb_vector_t<hb_serialize_context_t::object_t::link_t, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_vector_t<hb_pair_t<unsigned int, hb_vector_t<unsigned int, false> >, false> >(hb_vector_t<hb_pair_t<unsigned int, hb_vector_t<unsigned int, false> >, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_hashmap_t<unsigned int, unsigned int, false> >(hb_hashmap_t<unsigned int, unsigned int, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_hashmap_t<unsigned int, hb_set_t, false> >(hb_hashmap_t<unsigned int, hb_set_t, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false> >(hb_hashmap_t<unsigned int, hb_vector_t<unsigned int, false>, false> const&, graph::graph_error_t) Unexecuted instantiation: hb_result_t<void, graph::graph_error_t> hb_result_t<void, graph::graph_error_t>::from<hb_hashmap_t<unsigned int, graph::Lookup*, false> >(hb_hashmap_t<unsigned int, graph::Lookup*, false> const&, graph::graph_error_t) |
421 | | |
422 | 0 | bool is_ok () const { return is_ok_; } |
423 | 0 | bool is_err () const { return !is_ok_; } |
424 | | explicit operator bool () const { return is_ok (); } |
425 | | |
426 | | const E& error () const & { assert (!is_ok_); return err_; } |
427 | 0 | E& error () & { assert (!is_ok_); return err_; } |
428 | 0 | E error () && { assert (!is_ok_); return std::move (err_); } |
429 | | |
430 | | void operator * () & { return; } |
431 | | void operator * () const & { return; } |
432 | | void operator * () && { return; } |
433 | | |
434 | | bool operator == (const hb_result_t<void, E>& o) const |
435 | | { |
436 | | return is_ok_ == o.is_ok_ && (is_ok_ || err_ == o.err_); |
437 | | } |
438 | | |
439 | | bool operator != (const hb_result_t<void, E>& o) const |
440 | | { |
441 | | return !(*this == o); |
442 | | } |
443 | | |
444 | | bool operator == (hb_result_ok_t<void>) const |
445 | | { |
446 | | return is_ok_; |
447 | | } |
448 | | |
449 | | bool operator != (hb_result_ok_t<void>) const |
450 | | { |
451 | | return !is_ok_; |
452 | | } |
453 | | |
454 | | template <typename F> |
455 | | bool operator == (const hb_result_err_t<F>& e) const |
456 | | { |
457 | | return !is_ok_ && err_ == e.error; |
458 | | } |
459 | | |
460 | | template <typename F> |
461 | | bool operator != (const hb_result_err_t<F>& e) const |
462 | | { |
463 | | return !(*this == e); |
464 | | } |
465 | | |
466 | | template <typename U> |
467 | | bool operator == (const U&) const = delete; |
468 | | |
469 | | template <typename U> |
470 | | bool operator != (const U&) const = delete; |
471 | | }; |
472 | | |
473 | | template <typename U, typename T, typename E> |
474 | | static inline bool operator == (const hb_result_ok_t<U>& o, const hb_result_t<T, E>& r) |
475 | | { |
476 | | return r == o; |
477 | | } |
478 | | template <typename U, typename T, typename E> |
479 | | static inline bool operator != (const hb_result_ok_t<U>& o, const hb_result_t<T, E>& r) |
480 | | { |
481 | | return r != o; |
482 | | } |
483 | | template <typename F, typename T, typename E> |
484 | | static inline bool operator == (const hb_result_err_t<F>& e, const hb_result_t<T, E>& r) |
485 | | { |
486 | | return r == e; |
487 | | } |
488 | | template <typename F, typename T, typename E> |
489 | | static inline bool operator != (const hb_result_err_t<F>& e, const hb_result_t<T, E>& r) |
490 | | { |
491 | | return r != e; |
492 | | } |
493 | | |
494 | | #ifndef TRY |
495 | | #define TRY(expr) \ |
496 | 0 | do { \ |
497 | 0 | auto _res = (expr); \ Unexecuted instantiation: graph::graph_t::duplicate_subgraph(unsigned int, hb_map_t&)::{lambda(unsigned int, hb_serialize_context_t::object_t::link_t const*, unsigned int, unsigned int)#1}::operator()(unsigned int, hb_serialize_context_t::object_t::link_t const*, unsigned int, unsigned int) constUnexecuted instantiation: graph::graph_t::find_subgraph_size(unsigned int, hb_set_t&, unsigned int)::{lambda(unsigned int, hb_serialize_context_t::object_t::link_t const*, unsigned int, unsigned int)#1}::operator()(unsigned int, hb_serialize_context_t::object_t::link_t const*, unsigned int, unsigned int) const |
498 | 0 | if (unlikely (!_res.is_ok())) return Err(std::move(_res).error()); \ |
499 | 0 | } while (0) |
500 | | #endif |
501 | | |
502 | | #ifndef TRY_ASSIGN |
503 | | #define TRY_ASSIGN(var, ...) \ |
504 | 0 | auto HB_PASTE(_res_, __LINE__) = (__VA_ARGS__); \ |
505 | 0 | if (unlikely (!HB_PASTE(_res_, __LINE__).is_ok())) return Err(std::move(HB_PASTE(_res_, __LINE__)).error()); \ |
506 | 0 | var = *std::move(HB_PASTE(_res_, __LINE__)) |
507 | | #endif |
508 | | |
509 | | #endif /* HB_RESULT_HH */ |