Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: C++ template pointers vs. objects



A third option would be:

std::vector< boost::shared_ptr< largeObject > > objVect;

That gets you a vector of smart pointers, and saves you from writing
code to delete pointers that are held in the vector.  Code you don't
have to write is has fewer bugs.


On 5/25/05, Wesley Smith <email@hidden> wrote:
> Hi,
> 
> What is best practice in C++ when using templates and large
> objects...is it to declate a vector of pointers to an object or a
> vector of objects as in:
> 
> std::vector<largeObject *> objvect;
> 
> or
> 
> std::vector<largeObject> objvect;
> 
> thanks,
> wes
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Xcode-users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/xcode-users/email@hidden
> 
> This email sent to email@hidden
> 


-- 

C. Keith Ray
<http://homepage.mac.com/keithray/blog/index.html>
<http://homepage.mac.com/keithray/xpminifaq.html>
<http://homepage.mac.com/keithray/resume2.html>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >C++ template pointers vs. objects (From: Wesley Smith <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.