KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I need to write a class whose constructor takes a constant reference to a object and stores it locally. In order to avoid most common mistakes I can foresee, I'd like to only accept references to non-temporary (ie: references to lvalues). How can I write a function that takes constant references to non-temporary only? Of course even a non-temporary could go out of scope and thus break my class behavior, but I believe that by disallowing temporary references I will avoid most mistakes.
Tags (comma-separated)
Save Edits
Cancel