Boost logo

Boost :

From: Emily Winch (emily_at_[hidden])
Date: 2001-11-26 11:55:00

> Have you considered using std::pair as the 'dot pair' type? It doesn't
> really matter which template is used as long as it has two
> type parameters -
> it doesn't even need a definition. std::pair is handy since
> it automatically
> maps a value list (a tuple) to a typelist.

[ two people made the point that typelists should be instantiable ]

how about something like (off the top of my head)

template<typename Head, typename Tail> class dummy_pair_without_storage{
  // typedefs as per boost::compressed_pair

template<template<class, class> class PairType, typename Head, typename
class tuply_thing : public PairType<Head, Tail>{ // ok, a better name would
be good
  typedef PairType< Head, Tail > base;
  typedef typename base::first_type head_type;
  typedef typename base::second_type tail_type;
  // etc. etc.
  // constructors too

template<typename Head, typename Tail>
class typelist : public tuply_thing<dummy_pair_without_storage, Head,

template<typename Head, typename Tail>
class tuple : public tuply_thing<boost::compressed_pair, Head, Tail>{};


PS car and cdr would be fine by me :)

Boost list run by bdawes at, gregod at, cpdaniel at, john at