Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • Ok so this partially solves my problem but I don't like it because a) I now have to have multiple functions for the scenario's where T isn't a pointer and b) it isn't really const safe ie I can now do: void Add(typename std::remove_pointer<T>::type const*& Bar ) { Bar = "Boo"; } which changes 'name' to point to "Boo" now eek! Ok so thats easily solved with a const* const & but I still have to have multiple functions. Commented Apr 22, 2013 at 16:15
  • Bar = "Boo" only changes the pointer value passed, not the contents of the original string. If you want to prevent this change it to const* const&. This will prevent you from modifying variable it references. OF course at that point you should probably dump the reference and pass by pointer. Commented Apr 22, 2013 at 16:33