Boost logo

Boost Users :

Subject: Re: [Boost-users] [variant] Efficiency
From: Roman Perepelitsa (roman.perepelitsa_at_[hidden])
Date: 2009-06-17 10:18:32


2009/6/17 Maxim Koshelev <chuchelo_at_[hidden]>

> In common case it is not compiller solution due to complexity of
> constructors/destructors of holded class.
>
> variant<A,B> v( B() );
>

Note that this code does not create an instance of variant<A,B>, but
declares a function.

>
> this code MUST call constructor of class B two times. First time when
> B is created, second time when just created instance of B copyied to
> variant. Valid solution is use type-traits. Something like:
>
> variant<A,B> v( Trait<B>())
>

Same here.

Roman Perepelitsa.



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