Fernando Cacciola wrote:

[...]

>> Yes, something like that.  I am curious to know how in_place<> works.
>>
> Look at the thread "'optional' - request for extension"
> Essentilly,
>
> in_place<T>(a0,a1,a2...)
>
> just creates a function object which holds onto the argument list:
>
> template<class T, class A0, class A1>
> struct in_place_factory2
> {
>   in_place_factory2( A0& a0, A1& a2) : m_a0(a0), m_a1(a1) {}
>
>   A0& m_a0 ;
>   A1& m_a1 ;
> }
>
> and which has the following function call operator:
>
> void operator() ( void* address ) const
> {
>   new (address) T(m_a0,m_a1);
> }
>
> optional<> ctor just calls the function object passing its own
> m_storage as a parameter.

... but the number of arguments is limited this way.



Philippe A. Bouchard




_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to