Any++
Loading...
Searching...
No Matches
Casts

Mix and match downcast, crosscast, and obtain any with other. More...

Functions

template<is_any To, is_any From>
requires (std::derived_from<typename To::v_table_t, typename From::v_table_t>)
std::optional< To > anyxx::downcast_to (From from)
 Safe downcast to a derived trait using runtime information from the v-Tables.
template<typename U, typename Any>
auto anyxx::unerase_cast (Any const &o)
 Safe downcast to an unerased type using runtime information from the v-Tables.
template<typename U, typename Any>
auto anyxx::unerase_cast_if (Any const &o)
 Safe downcast to an unerased type using runtime information from the v-Tables.
template<is_any ToAny, is_any FromAny>
std::expected< ToAny, cast_error > anyxx::borrow_as (FromAny const &from)
 Safe crosscast via runtime information to another any without changing the ownership.
template<is_any ToAny, is_any FromAny>
std::expected< ToAny, cast_error > anyxx::clone_to (FromAny const &from)
 Clone via runtime information.
template<is_any FromAny>
auto anyxx::lock (FromAny const &from_interface)
 Lock a shared any.
template<is_any ToAny, is_any FromAny>
ToAny anyxx::move_to (FromAny &&from)
 Move ownership to another any. Uses runtime information to crosscast, if necessary.

Detailed Description

Mix and match downcast, crosscast, and obtain any with other.

IMPORTANT: For crosscasts to work, the models must be registered with the ANY_REGISTER_MODEL macro.