
John Maddock wrote:
Anything else coming to your mind what could be bad about this adaptor? I want it to be as robust as possible because I intend to use it a lot.
You need to add the const declaretor, *after* you remove the reference (adding cv-qualifiers to reference types has no effect).
No, that gives a different effect to what I intended. The task is to take an argument_type that could be either a value or a reference, and convert it to a corresponding pointer type. If the argument_type is a (const or non-const) reference, then simply removing the reference is what is required. Adding const after that would fail for argument_type's that are non-const references as *ptr would be a reference to a const. Conversely, if argument_type is not a reference, then the pointer type should be a pointer to const, because the argument will be copied anyway so there is no reason to forbid using it with const objects. Unless I missed something, adding const followed by removing reference should achieve this. Cheers, Ian