Sleep is for the weak

Published August 18, 2004
Advertisement
For lack of anything better to post, I'll share a stupid mistake I've made with you all. I created a function object for use with the std::sort() algorithm that depended on a external object, so I decided to store a reference. It basically looked like:
class Sorter {  public:    Sorter(const Object ref) : ref_(ref) {}    // other stuff  private:    const Object & ref_;};

See what the problem is? That's right, I ended up storing a reference to the parameter that was passed on the stack.
Previous Entry Hardware and freebies
Next Entry Musings
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement

Latest Entries

New bug to me

1910 views

Week/Class 9

1740 views

Week/Class 8

1789 views

Week/Class 7

1835 views

The promised files

2115 views

Week/Class 6

1518 views

Week/Session 5

1578 views

Week/Session 4

1519 views

On the soapbox

1636 views

Week/Session 3

1494 views
Advertisement