Boost logo

Boost :

Subject: Re: [boost] [cpo-proposal] presentation of the idea
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-08-20 04:30:23


On 19-08-2013 22:18, Larry Evans wrote:

>>
> The 1st attachment uses the offset method for the container
> and has the:
>
> template<typename F> void push_back(F const&);
>
> method.
>
> The output is in 2nd attachment.

You work fast :-)

Since the classes in a hierarchy is normally not copyable (though
perhaps cloneable), I would make push_back like this:

template< class T, typename... Args >
void push_back( Args... args )
{
    // A. static assert that T* is convertiable to Base*
    // B. all the usual stuff
    // C. in-place construct from std::forward(args)...
}

-Thorsten


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