Added `assume_init()`, added explicit creation via explicitly named static methods move and in-place object construction
Fortune for libexopt's current commit: Future blessing − 末吉
template<polymorphic_castable<T>U,boolCheck=!std::derived_from<U,T>>// Default dynamic check set to false only if we can statically determine that T is derived from U and the conversion is therfore infallible
static_assert(util::shares_layout<Box<_Complexdouble>,_Complexdouble*>,"Invalid Box<T> memory layout: More than just T*");
static_assert(util::shares_layout<Box<_Complexdouble>,std::unique_ptr<_Complexdouble>>,"Invalid Box<T> memory layout: More than just std::unique_ptr<T>");
template<typenameT,typenameR/*XXX: Maybe remove this, and put the requires after the definition, using `auto&& value` instead of `R&& value`*/>requires(std::derived_from<R,T>)
constexprBox<T>box(R&&value,util::comptime<bool>autoCheck=_EO_CONSTANT_VALUE(false))noexcept(std::is_nothrow_invocable_v<Box<T>::new_dynamic<R,util::comptime_eval_v<bool,Check>>)//XXX: This seems illegal...
//TODO: Use pointer traits of P to deduce `pointer_type`, so we can have P be a shared_ptr too. Or perhaps, a specialisation for `Cow<std::shared_ptr<T>>` would be better
},m_value))returnm_value.emplace<value_type>(*ct_from);//XXX: Do we need to create a temporary here for creating invariants by reading the old invariant?
//TODO: I don't think this works the way I want it to... We'll need to emplace inside this function I think, since the moved temporary has been moved. It might not matter though.
},std::move(m_value)))returnstd::move(m_value.emplace<value_type>(*ct_from));//XXX: Do we need to create a temporary here for creating invariants by reading the old invariant?
}
//These commented out visits modify the pointee of the borrowed invariant. THIS IS NOT WHAT WE WANT. Instead, we emplace a copy and then copy it again (possibly elided: &) or return it as an rvalue reference (elided: &&)
constexprvirtualtypes::MaybeOwned<Report>into_report()noexcept{/* TODO */}//TODO: Maybe just use `std::optional<std::reference_wrapper<Error>>`? Or Box<Report&>?
/// Used to store all valid command names, so when an invalid one is found, the closest matching one(s) can be suggested to the user in a "did you mean ..." format with the *lowest difference* neighbour(s) to the invalid string first.
// Throws NullDerefException<?> for first type of `ptr` that is null (if any are).
// If: `All == true`: Instead will always throw `NullDerefException<T...> (all types) if any are, and will not assume every pointer is likely to be non-null.
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,T&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,Tconst&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,T&&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
->NonNull<std::add_pointer_t<std::invoke_result_t<Func,Tconst&&>>>//TODO: Can we extend this for: void returns, pointer (not reference) returns, maybe even std::convertible_to<?*> returns?
/// Deducable version of `is_empty_pack<typename...>()`
///
/// Can be used as `is_empty_pack(pack...)` instead of the slightly more ugly `is_empty_pack<decltype(pack)...>()` though with (very unlikely, but possible) implications of actually "evaluating" the pack (despite the values themselves are `const&` and never used, they're still passed.)
/// HOWEVER: The latter should likely be preferred, since this function takes possible-nonconstexpr types as arguments, it cannot be immediate like the non-argument taking overload. See below comment for more information on that.
template<typename...A>
[[gnu::const]]//TODO: XXX: This mostly useless function won't mess up overload resolution for `is_empty_pack<types...>()`, right? If it will, either find a way to make sure it comes LAST, or remove it, it's not worth the hassle just so users (i.e. me) can avoid typeing `decltype` for once in my fuckin life... what a stupud keyword name srsl (see static_assert() below.)
andis_empty_pack<>()//XXX: This might also be ambiguous between the type and value one... Eh.... That's actually useful though, so removing this explicit (and pointless) *usage* of the function from the test would be fine if they don't clash in other ways too.
static_cast<void(std::string_view&&)>(throw_runtime)({std::move(msg)});//XXX: We may have to rename the above function (and make it [[internal]], or refactor to make it a private method of a function-object class `throw_runtime` to avoid ambiguations when constexpr-context calls it with the exact typed argument `std::string_view&&`... Maybe... I'm not really sure.
}
__builtin_unreachable();
}
// Returns an anonymous union with inavtive field: `T value` and active field `assume init` (no unique address).