xieite::any::operator T()

Defined in fragment xieite:any
(header-only: <xieite/meta/any.hpp>)


A declared cast operator of xieite::any to any other type. Must be used in unevaluated context, as it is not actually implemented.

This is not marked constexpr because it would otherwise have to be implicitly instantiated if the existence of its definition affects the semantics of the program if it is needed for constant evaluation (even if not required) if this function is named by an expression that is potentially constant evaluated if the expression is an immediate subexpression of a brace initializer list.
Basically, this function would behave differently in a case like int { xieite::any() }.

Declaration

explicit(false) operator T() const noexcept;


Example

import xieite;

void f(int, float, char16_t***&&) {}

int main() {
	xieite::any any;

	// Check if `f` is callable with three arguments of any type
	xieite::dump(requires { f(any, any, any); });
}
Output:
true
View in Compiler Explorer