PrevUpHomeNext

kpp::roll_v


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

kpp::roll_v is a c++ type trait of kpp c++ library. kpp::roll_v has three template arguments: condition, value_v00, value_v01. If condition is true, the result value is value_v00, otherwise it is value_v01.

kpp::roll_v Sig:

template <bool condition, auto value_v00, auto value_v01>
constexpr inline auto roll_v = ...;

Note the type of the result value might be the type of value_v00 or value_v01, so the auto is very helpful here.

include

#include <kpp/types.hpp>

c++ example

#include <kpp/types.hpp>

int main()
{
	static_assert(kpp::roll_v<true, 3, 2.5> == 3);
}

See Also

kpp::roll_t

Back

Up










Deck

Kpp Home

K


PrevUpHomeNext