PrevUpHomeNext

kpp::same_assert


---- kpp::same_assert << Type System << Kpp c++ ----

kpp::same_assert is a c++ class of kpp c++ library.

kpp::same_assert is a class template, it puts a static_assert inside its class body to check if the two types of the template argument are the same. If the two types are the same, static_assert succeeds, otherwie fails.

AKA. kpp::same_assert <====> static_assert + kpp::same_as

Note that the two types must be exactly the same.

kpp::same_assert usage Sig:

kpp::same_assert<type1, type2>{};
kpp::same_assert<type1, type2, true>{};
kpp::same_assert<type1, type2, false>{};

true by default.

include

#include <kpp/types.hpp>

c++ example

#include <kpp/types.hpp>

int main()
{
	kpp::same_assert<int, int>{};	// static_assert OK
	//kpp::same_assert<int, int &>{};	// static_assert fails
}

See Also

kpp::bare_same_assert

kpp::same_as

kpp::not_same_as

Back

Up










Deck

Kpp Home

K


PrevUpHomeNext