10.4 ○月D日 (W曜) は,その月の何回目のW曜日?

次のメタ関数は、○月 Day 日 (dow 曜日) が,その月の何回目の dow 曜日かを返します。

template<int Day>
struct day_to_nth_day_of_week
{
  static const int value = (Day - 1) / 7 + 1;
};

元ネタ
このエントリーを含むはてなブックマーク