Just a quick question for anyone who has knowledge about this stuff: if I have a cv-qualifier for a variable (e.g.: const ItemType& data), how would I pass it by value, or make a copy of it?
The pass by value bit seems stupid to ask, but the whole ampersand being there really confuses me. Any help?
> if I have a cv-qualifier for a variable (e.g.: const ItemType& data),
> how would I pass it by value, or make a copy of it?
Assuming that the type (ItemType) is CopyConstructible, in exactly the same way as you would pass by value, or make a copy of a variable that is not cv-qualified.
bar() represents simply any code whatsoever where the reference may have come from.
baz() is the function you want to pass [the object to which the reference points] by value.