|
Boost Users : |
From: Mark Storer (mstorer_at_[hidden])
Date: 2002-11-06 16:29:50
>I don't believe the above statement will affect me,
>but I just want to be sure
Correct. A language-level array is not an STL container.
There IS a shared_ptr-like template called shared_array that calls "delete
[]" instead of "delete". Had to look that one up. It doesn't get used
much. std::vector is a superior choice (in every situation I can think of).
An STL container of shared_ptr's is just fine. Just don't create a circular
reference.
--Mark Storer
Software Engineer
Cardiff Software
#include <disclaimer>
typedef std::disclaimer<Cardiff> Discard;
-----Original Message-----
From: Collin Peters [mailto:yg-boost-users_at_[hidden]]
Sent: Wednesday, November 06, 2002 1:04 PM
To: boost-users_at_[hidden]
Subject: [Boost-Users] shared_ptr capabilities
http://www.boost.org/libs/smart_ptr/shared_ptr.htm states that:
"Normally, a shared_ptr cannot correctly hold a pointer to a dynamically
allocated array. See shared_array for that usage."
What I hope to use shared_ptr for, is to store pointers to a class in a
vector, and that class will also have a vector that stores pointers via
shared_ptr.
example:
class Foo {
int a;
}
class one {
int var1;
int var2;
std::vector<Foo> foo_vector;
}
class two {
std::vector<one> one_vector;
}
I don't believe the above statement will affect me, but I just want to be
sure
Collin Peters
Info: <http://www.boost.org>
Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl>
Unsubscribe: <mailto:boost-users-unsubscribe_at_[hidden]>
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net