tags:

views:

750

answers:

1

I noticed that when passing reference parameters to boost bind, those parameters won't act like references. Instead boost creates another copy of the member and the original passed in variable remains unchanged.

When I change the references to pointers, everything works ok.

My question is:

Is it possible to get references to work, or at least give a compiling error when it tries to use reference parameters?

+11  A: 

The boost documentation for bind suggests that you can use boost::ref and boost::cref for this.

Timo Geusch