Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-03-21 16:15:51


"Thorsten Ottosen" <nesotto_at_[hidden]> writes:

> "Jens Theisen" <jens.theisen_at_[hidden]> wrote in message
> news:d1nbk5$c0q$1_at_sea.gmane.org...
> | Thorsten Ottosen wrote:
> | > ctor() : v( list_of(1)(2).to_container(v) )
> | > { }
> |
> | What are you proposing? You don't want to write to v before it's
> | construction, do you?
> |
> | I see that this is somewhat anoying. Even with implicit_cast, because
> | then you have to give the containers type in the initialisation again.
>
> to_container(v) is actually an existing work-around for compilers which can't
> even do
> Cont = list_of(...);
>
> All it does is to deduce the return type; it doesn't write to v, it finds its
> type.
>
> I should update the docs to make this a more used method of disambiguation

In the spirit of recent work by Eric Niebler, I think you can use:

   v = 0?v: list_of(...)

FWIW ;-)

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk