ruben safir <
ru...@mrbrklyn.com> writes:
>On 11/08/2016 09:48 AM, Alf P. Steinbach wrote:
>>>
>>> that would be an error. You can't use a non-member function on a const
>>> varriable, FWIW.
>>
>> I'm sorry, but that doesn't make sense to me.
>>
>
>A non-member function is one outside of the class.
So what? That doesn't preclude the function from using
const arguments, nor does it preclude the function from
using non-member const variables.
>>
>>> There might not be a means to const this, as long as a
>>> non-member function is working on the variable.
>>
>> Not sure what this means either, sorry.
>>
>
> Functions from outside of a class can not guarantee through const the
>integrity of a function argument.
c'est what?
static void function(const int& a)
{
a = 10; // ERROR
}
/tmp/a.cpp: In function 'void function(const int&)':
/tmp/a.cpp:4: error: assignment of read-only reference 'a'