14 Jul 23:43
how can I return a 'null' smart pointer?
Meryl Silverburgh <silverburgh.meryl <at> gmail.com>
2008-07-14 21:43:46 GMT
2008-07-14 21:43:46 GMT
Hi,
Can you please tell me how can I return a 'null' smart pointer?
typedef shared_ptr<MyA> MyAPtr;
typedef vector<MyAPtr> MyAVector;
For example,I have this code, which return NULL in an error situation:
MyAPtr myfunction(MyAVector& v, int size) {
if (index < v.size()) {
return v[index];
} else {
// how can I return NULL here?
}
}
How can I achieve that when I use boost smart pointer?
Thank you for any tip.
RSS Feed