Boost logo

Boost :

From: Jens Theisen (jens.theisen_at_[hidden])
Date: 2005-03-21 15:44:55


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.

I have read somewhere that template default arguments for functions
might come into the language at some point in the future. In this case,
one could write:

template< typename Container,
           typename Unused = typename Container::iterator >
operator Container() const { ... }

This would then be a subsitution failure for all the single args a
std::vector ctor takes untemplated (I may be mistaken), and thus giving
no candidate for a ctor call.

Unfortunately, this theory could only be tested on a compiler that
already has this language extension. Does anyone know if there is one?

Any other thoughts?

Jens


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