← Back to team overview

kicad-developers team mailing list archive

Re: RS274X file format.

 

Dick Hollenbeck wrote:
> Dick Hollenbeck wrote:
>> 
>>> This is why I have been using wxList and wxArray instead of C++ list and
>>> vector. 
>>> 
>>
>> I don't share your enthusiasm for these two containers.
>>
>> There is little standard about C++ if <vector> is not. 
>>
>> In fact I would even disagree with you. wxString is reasonable because 
>> it is unicode and work with the gui functions. Beyond that using 
>> standard C++ containers is entirely safe and likely gives you an easier 
>> path to a different GUI library. Say somebody wanted to go to QT 
>> someday......
>>
>>
>> Dick
>> 
> 
> Well I came back here and see that I said nothing about C++ list. If 
> the object being put on a list is an object derived from our 
> base_struct, then we have our DLIST<> stuff and that is the list type to 
> be used.

The code I fixed in CVPcb was not base_struct derived. It was yet
another previous/next pointer implementation that was handled by inline
code. I am pretty sure I have seen some code in Eeschema that follows
the same pattern.

> C++ list actually requires two memory allocations for each node so I 
> *never* use it, ever. In fact I never use any linked list framework 
> which requires more than a single memory allocation per node. Vector 
> and the boost ptr_vector are way better than C++ list for non 
> base_struct derived object containers. 

I'll take a look at Boost ptr_vector and C++ vector as a replacement for
wxList.

> For anything of complexity, ptr_vector wins the day, and it is not even 
> a close call, because all such instantiations share common code based on 
> std::vector<void*>, and the object can be destroyed automatically via 
> pointer only at container destruction time. Copy constructors don't 
> enter in because only a pointer is in the container, not the actual 
> object copy.

Thanks for the information. It saves me a lot of time figuring it out
on my own.

Wayne

> 
> 
> IMO.
> 
> Dick



 




References