Error: function `...` without `this` cannot be `const`

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Wed Jun 30 18:10:52 UTC 2021


On Wednesday, 30 June 2021 at 17:47:05 UTC, someone wrote:
> ...

That is because const/immutable/shared are being applied on the 
object hence 'this' variable inside function body if function is 
a member of a struct or class. It doesn't make sense to have a 
const modifier on a simple function. What will that const mean 
then in context of that function? To what it will be applied?

Best regards,
alexandri.


More information about the Digitalmars-d-learn mailing list