xieite::any {}

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


A metaprogramming helper class thing. Defines a constructor from any type and declares that it is convertible to any type.


Definition

struct any {
	any() = default;

	constexpr any(auto&&...) noexcept;

	template<typename T>
	explicit(false) operator T() const noexcept;
};

Special member functions

 - any()

Operators

 - operator T()


Example

import xieite;

void f(int, int, int, int, int, int, int) {}

int main() {
	// Check if `f` is callable with any amount of arguments (up to 256)
	xieite::dump([](this auto self, auto... args) {
		if constexpr (sizeof...(args) > 256) {
			return false;
		} else if constexpr (requires { f(args...); }) {
			return true;
		} else {
			return self(args..., xieite::any());
		}
	}());
}
Output:
true
View in Compiler Explorer