Listing 1: Tuple class.

template <class T, class U>
struct derive_from : public T, public U
{
  ...
};
struct empty_type
{};
template <class List> struct derive_from_all
{
  typedef derive_from<
    typename List::head,
    typename derive_from_all<typename List::tail>::result> result;
};
template <> struct derive_from_all<null_type>
{
  typedef empty_type result;
};
template<class FieldList>
  struct tuple : public derive_from_all<FieldList>::result
{
  typedef FieldList field_list;
  template<class Col>
  typename Col::type& operator[](Col&){
    return static_cast<Col&>(*this).value;
  }
  template<class Col>
  const typename Col::type& operator[](Col&) const {
    return static_cast<const Col&>(*this).value;
  }
  ...
};