`.' cannot appear in a constant-expression

后端 未结 4 1041
悲哀的现实
悲哀的现实 2021-01-21 23:56

I\'m getting the following error:

`.\' cannot appear in a constant-expression

for this function (line 4):

    bool Covers(const         


        
4条回答
  •  时光说笑
    2021-01-22 00:28

    I assume this fails because the [] operator is not a valid operation on your variables me, other, etc.

    • Did you overload the [] operator on your Region<> class? If so, does it return an object which actually has these min and max members? — Does the overloaded operator return an object, an object by reference, or a pointer to an object? (In the last case, you'd need to replace . by ->.)

    • If you haven't overloaded [], then me, other etc. would have to be declared as an array for your code to be valid.

提交回复
热议问题