Boost logo

Boost Users :

From: John.Wismar_at_[hidden]
Date: 2004-07-12 16:17:33


I've been playing with Boost's tuples library, but I'm having some trouble
working through a wrinkle:

I have some routines that use tuple<int>, tuple<int, int>, etc., up to
tuple<int, int, int, int, int>. I'd like to be able to declare these
objects using an alternative notation, along the lines of:

tuple_clone<int, 1>, tuple_clone<int, 2>, tuple_clone<int, 3>, etc.

The objective would be to allow me to write a function template that looked
something like this:

template <int N>
tuple_clone<int, N> fn(tuple_clone<int, N-1> t)
{
    tuple_clone<int, N> ret;
    ret.get_head() = getValue();
    ret.get_tail() = t;
    return ret;
}

Each time I try to write tuple_clone, though, I end up stumped. Is it
possible to write something like this, while leveraging the tuples library?
Or is there a different approach I ought to look into?

Thanks!

--------------------------------
John Wismar
john.wismar_at_[hidden]
------------------------------------------------------------------------
The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipient is prohibited. If you received
this in error, please contact the sender and delete the material from any
computer.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net