Boost logo

Boost Users :

Subject: Re: [Boost-users] a tuple from a pair?
From: Lars Viklund (zao_at_[hidden])
Date: 2011-10-05 17:57:09


On Wed, Oct 05, 2011 at 09:07:56PM +0200, Krzysztof Żelechowski wrote:
> Krzysztof Żelechowski wrote:
>
> > How come a tuple, being a generalisation of a pair, cannot be constructed
> > from one?
> >
> > I mean something along the lines
> >
> > make_tuple (pair const &p) { return make_tuple (p.first, p_second); }
> >
> > Would be good to have.
>
> It turns out that TR1 supports constructing a tuple directly from a pair,
> so Boost should catch up.

-- 
Are you sure you're not misunderstanding what your implementation does?
VC10 and GCC 4.4.5 makes (rightfully so) a 1-tuple with an element of
type pair<T1,T2> when invoking make_tuple with a pair.
I would be _very_ surprised if I got a 2-tuple if I make_tuple(a_pair)
and would consider it a serious bug in the library.
Lars Viklund | zao_at_[hidden]

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