/**
 * @brief Get the length of the tuple.
 */

template<class T>
struct Length  {
   ...
};

...

/**
 * @brief Get the type of the N-th element of the tuple.
 */
template <int N,class Tuple>
struct ElementType {
  typedef typename ElementType<N-1,typename Tuple::Type2>::Type Type;
};
template<class Tuple>
struct ElementType<0,Tuple> {
  typedef typename Tuple::Type1 Type;
  typedef typename Tuple::Type2 Type2;
};
template<int N, typename T1, typename T2>
struct ElementType<N,Pair<T1,T2> >
{
  /**
   * @brief The type of the N-th element of the tuple.
   */
  typedef typename ElementType<N-1,T2>::Type Type;
};
/**
 * @brief Get the type of the first element of the tuple.
 */
template<typename T1, typename T2>
struct ElementType<0, Pair<T1,T2> >
{
  /**
   * @brief The type of the first element of the tuple.
   */
  typedef T1 Type;
};
  
/**
 * @brief Get the N-th element of a tuple.
 */
template<int N>
struct Element
{
 ...
};

...