$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Christopher Kohlhoff (chris_at_[hidden])
Date: 2006-05-31 21:20:08
Hi Beman,
Beman Dawes <bdawes_at_[hidden]> wrote:
> That said, I guess there could be an argument to expose the
> templates for those who prefer them.
Here's an argument for exposing templates: it allows the
template parameter to propagate up into my own types. I'm
thinking something like:
  template <typename Endianness>
  struct my_message
  {
    integer<4, Endianness> foo;
    integer<2, Endianness> bar;
    ...
  };
This permits me to write one function template to handle
my_message structures in programs that need to deal with both
little- and big-endian at runtime (i'm thinking "receiver makes
right" protocols).
With this scheme there should probably also be a type for native
endianness so we could write:
  my_message<endian::big> msg1;
  my_message<endian::little> msg2;
  my_message<endian::native> msg3;
etc. In my opinion a similar argument applies to exposing the
alignment as a template parameter.
Cheers,
Chris