By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

Container with pointers

P: n/a


Hi,
Can a container contains pointers to objects but hands out a references
to them?

somthing like the following:

std::map<long,Course_c*courses;
:
:
Course_c& course=courses[1000];
Thanks in advance.

Nov 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

tomix wrote:
Can a container contains pointers to objects but hands out a references
to them?

somthing like the following:

std::map<long,Course_c*courses;
:
:
Course_c& course=courses[1000];
Not out of the box, no. But you could always put a wrapper around the
container to give it the functionality you want.

By the way, why do you want to do this? What's wrong with:

Course_c& course = *courses[1000];

?

Best regards,

Tom

Nov 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.