Click here to Skip to main content
15,906,645 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
Questionmemory leak Pin
anithavikram(manisha)20-Nov-07 20:06
anithavikram(manisha)20-Nov-07 20:06 
AnswerRe: memory leak Pin
Stuart Dootson20-Nov-07 21:49
professionalStuart Dootson20-Nov-07 21:49 
QuestionHow to transfer file using ATL SERVER .net 2003 [modified] Pin
SSATYAMASKE19-Nov-07 22:12
SSATYAMASKE19-Nov-07 22:12 
QuestionHow to Provide 30 day Trial Version Pin
swamy Narasimha17-Nov-07 0:47
swamy Narasimha17-Nov-07 0:47 
AnswerRe: How to Provide 30 day Trial Version Pin
ThatsAlok24-Nov-07 0:15
ThatsAlok24-Nov-07 0:15 
QuestionSerial Port Pin
sunny.rana12-Nov-07 9:57
sunny.rana12-Nov-07 9:57 
AnswerRe: Serial Port Pin
Nathan Holt at EMOM16-Nov-07 6:56
Nathan Holt at EMOM16-Nov-07 6:56 
Questionwhen to/why use Allocator::construct()? [modified] Pin
jens rasmussen11-Nov-07 4:29
jens rasmussen11-Nov-07 4:29 
Hi all!

I'm developing an standard-compliant STL associative container, and the biggest problem, by far, has been how to use the allocator template argument.

NB: I have chosen not to support alternative pointers.

I have two questions that I hope you can help me answer.

Question 1:
-----------
After having allocated a new node-object, why does one use value_allocator.construct() to construct the value instead of just passing it by assignment? I have checked out the SGI and GNU implementation of stl_tree.h, and they just use assignment for bool, size_type and pointer values, why not do the same or use placement new for other values? After all, one of the requirements for container elements is that they must be copyable and assignable.

... a possible answer could be "because construct may have wanted side-effects such as logging". If so, why only support the side-effects when constructing value_type and node_type?

Question 2:
-----------
Besides node-elements, I also employ the following struct:

struct{ link_type n; stack<my_enum> s;}

- After I have allocated new space for my struct, can I just do a struct_allocator.construct() on it, or am I supposed to only do a stack_allocator.construct() on the stack element contained?

Jens Rasmussen


-- modified at 10:42 Sunday 11th November, 2007
AnswerRe: when to/why use Allocator::construct()? Pin
Stuart Dootson12-Nov-07 15:30
professionalStuart Dootson12-Nov-07 15:30 
GeneralRe: when to/why use Allocator::construct()? Pin
jens rasmussen13-Nov-07 1:07
jens rasmussen13-Nov-07 1:07 
GeneralRe: when to/why use Allocator::construct()? Pin
Stuart Dootson13-Nov-07 5:01
professionalStuart Dootson13-Nov-07 5:01 
AnswerRe: when to/why use Allocator::construct()? Pin
led mike13-Nov-07 4:53
led mike13-Nov-07 4:53 
GeneralRe: when to/why use Allocator::construct()? Pin
Stuart Dootson13-Nov-07 5:12
professionalStuart Dootson13-Nov-07 5:12 
GeneralRe: when to/why use Allocator::construct()? Pin
led mike13-Nov-07 6:11
led mike13-Nov-07 6:11 
JokeRe: when to/why use Allocator::construct()? Pin
George L. Jackson13-Nov-07 11:09
George L. Jackson13-Nov-07 11:09 
JokeRe: when to/why use Allocator::construct()? Pin
led mike14-Nov-07 4:46
led mike14-Nov-07 4:46 
QuestionPush File into STL list Pin
Jeffrey Walton9-Nov-07 9:36
Jeffrey Walton9-Nov-07 9:36 
AnswerRe: Push File into STL list [modified] Pin
Rajasekharan Vengalil10-Nov-07 12:51
Rajasekharan Vengalil10-Nov-07 12:51 
GeneralRe: Push File into STL list Pin
Jeffrey Walton10-Nov-07 13:21
Jeffrey Walton10-Nov-07 13:21 
AnswerRe: Push File into STL list Pin
Stephen Hewitt11-Nov-07 15:49
Stephen Hewitt11-Nov-07 15:49 
GeneralRe: Push File into STL list Pin
Jeffrey Walton12-Nov-07 5:09
Jeffrey Walton12-Nov-07 5:09 
GeneralRe: Push File into STL list Pin
Stuart Dootson12-Nov-07 15:11
professionalStuart Dootson12-Nov-07 15:11 
AnswerRe: Push File into STL list Pin
Stuart Dootson11-Nov-07 22:54
professionalStuart Dootson11-Nov-07 22:54 
GeneralRe: Push File into STL list Pin
Jeffrey Walton12-Nov-07 5:11
Jeffrey Walton12-Nov-07 5:11 
GeneralRe: Push File into STL list Pin
Stuart Dootson12-Nov-07 15:07
professionalStuart Dootson12-Nov-07 15:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.