PrevUpHomeNext

kpp::bare_same_assert


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

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

kpp::bare_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 after applying kpp::remove_cvref_t. If the two types are the same after applying, static_assert succeeds, otherwie fails.

Note that kpp::remove_cvref_t is applied before checking.

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

kpp::bare_same_assert usage Sig:

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

true by default.

include

#include <kpp/types.hpp>

c++ example

#include <kpp/types.hpp>

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

See Also

kpp::same_assert

kpp::same_as

kpp::not_same_as

Back

Up










Deck

Kpp Home

K


PrevUpHomeNext