// size of the chessboard
const int size = 8;
// some bookkeeping
template <class C, class F, class S>
struct state {
typedef C columns;
typedef F first_diag;
typedef S second_diag;
typedef state<C,F,S> this_type;
template <class Col, class Row> struct calc_diag {
typedef item<Row::id + Col::id> first_d;
typedef item<size - 1 - Row::id + Col::id> second_d;
};
template <class Col, class Row> struct isValid : calc_diag<Col,Row> {
static const bool result =
inSet<columns, Col>::result &&
inSet<first_diag, first_d>::result &&
inSet<second_diag, second_d>::result ;
};
template <class Col, class Row> struct use : calc_diag<Col,Row> {
typedef typename select <
null,
state<
typename remove<columns, Col>::result,
typename remove<first_diag, first_d>::result,
typename remove<second_diag, second_d>::result>,
this_type::isValid<Col, Row>::result >::result result;
};
};