How is a playing card's rank represented most elegantly in code?

* Should be a customized uint/an own type representing uints in the range of 2 through 14.
* void foo(Rank rank) {  } // Accepts only the valid range
  foo(0);  // Error
  foo(2);  // Ok
  foo(10); // Ok

  alias J 11;
  alias Q 12;
  etc.,

  foo(J);  // Ok
  foo(Q);  // Ok
  foo(B);  // Error


Reply via email to