CV-qualifier question

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?
1
2
3
4
const T &foo = bar();
T copy = foo;
//void baz(T quux);
baz(foo);
Is there any way to do it without having to introduce a new function?
What new function?
bar() and baz()
> 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.
Topic archived. No new replies allowed.