
On 03/15/2016 07:25 PM, Glen Fernandes wrote:
You mentioned a while back that you preferred: p.reset(new X(args...)); because it was intuitive, and in your opinion more intuitive than: p = f<X>(args...);
Nobody would have any issue with that. But people would certainly have issue with: Y::Z b(a); p = new (b) Q(b, args...); compared to p = g<X>(a, args...);
Well first if you have a as an r-value: p = g<X>(a, args...) That means the allocator parameter must be constant: g<X>(Allocator const &, arg...) If it's constant it won't be able to change its internal state. I thought that was the purpose of having instantiable allocators? I can write a wrapper function for: p1 = new (a1) node(a1, 1, 'a'); But not for the declaration of the allocator: boost::node<U, Allocator<U> >::allocator_type a1(n1, m1); Why? Because you allocate node<U>s, not Us. I could write some node_traits<> helper: template <typename T, template <typename> class A> { typedef typename boost::node<T, A<T> >::allocator_type allocator_type; }; So that the declaration becomes: boost::node_traits<U, Allocator>::allocator_type a1(n1, m1); But that's all I can do. -Phil