22template<
typename PosType, auto MinHealth, auto MaxHealth, auto StartHealth=MaxHealth>
24 static_assert(MinHealth <= StartHealth);
25 static_assert(MaxHealth >= StartHealth);
29 MinHealth, MaxHealth, StartHealth
32 using Position = PosType;
34 static constexpr Health maxHitPoints = (Health)MaxHealth;
35 static constexpr Health minHitPoints = (Health)MinHealth;
40 Health hitPoints = (Health)StartHealth;
47template<auto MinX, auto MinY, auto MaxX, auto MaxY>
51 MinX, MinY, MaxX, MaxY
54 static constexpr Position minLimit = { (Coord)MinX, (Coord)MinY };
55 static constexpr Position maxLimit = { (Coord)MaxX, (Coord)MaxY };
62int main(
int,
char**) {
64 auto always = out.always();
65 auto expect = out.expect();
71 using Enemy = Mob<Position<-200, -200, 200, 200>, 0, 300>;
73 always <<
"Enemy = Mob<Position<-200, -200, 200, 200>, 0, 300>\n"
75 out << getTypeName<typename Enemy::Health>() <<
"\n";
76 expect << getTypeName<std::uint16_t>() <<
"\n";
78 always <<
"Enemy::Position::Coord: ";
79 out << getTypeName<typename Enemy::Position::Coord>() <<
"\n";
80 expect << getTypeName<std::int16_t>() <<
"\n";
Obtain an integer type from its width, or from some values that must be representable.
typename least_required_int_type_finder<>::template type< V... > least_required_int_type