lion03 / thrust

Automatically exported from code.google.com/p/thrust
Apache License 2.0
0 stars 0 forks source link

c++11 requires vector_base to construct elements using its allocator #367

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We do it in an ad hoc fashion, but we're required to use the allocator 
according to S. 23.2.1 subpoint 3:

For the components affected by this subclause that declare an allocator_type, 
objects stored in these
components shall be constructed using the 
allocator_traits<allocator_type>::construct function and
destroyed using the allocator_traits<allocator_type>::destroy function 
(20.6.8.2). These functions
are called only for the container’s element type, not for internal types used 
by the container. [ Note: This
means, for example, that a node-based container might need to construct nodes 
containing aligned buffers
and call construct to place the element into the buffer. —end note ]

This is actually a good thing for us, because it means that the user should be 
able to create an uninitialized_allocator, if he desires.

Original issue reported on code.google.com by jaredhoberock on 28 Aug 2011 at 2:34

GoogleCodeExporter commented 8 years ago
See this post [1] for why it's worthwhile to do this sort of thing.

[1] 
http://stackoverflow.com/questions/7218574/avoiding-default-construction-of-elem
ents-in-standard-containers

Original comment by jaredhoberock on 28 Aug 2011 at 11:00

GoogleCodeExporter commented 8 years ago
Delaying to 1.7

Original comment by jaredhoberock on 30 Jan 2012 at 7:59

GoogleCodeExporter commented 8 years ago
Forwarded to github:

https://github.com/thrust/thrust/issues/33

Original comment by jaredhoberock on 7 May 2012 at 8:31