is this a variable or function

前端 未结 2 729
别那么骄傲
别那么骄傲 2021-01-01 07:08

I was just looking through implementation of non local means algorithm via google (thanks google for code search) and come across this function mirror.

temp         


        
相关标签:
2条回答
  • 2021-01-01 07:24

    It is a variable declaration, and it is equivalent to this:

    const int32 alpha = src%size;
    
    0 讨论(0)
  • 2021-01-01 07:47

    This is a variable declaration. A declaration of the form:

    type variablename = value;
    

    is essentially equivalent to:

    type variablename(value);
    

    This is the case regardless of what type is - whether it is a user-defined class or a built-in type. Note that the reverse is not always the case - the = syntax requires that there be an accessible copy constructor.

    For similar reasons, you can cast arithmetic types using the constructor syntax, as in: x = int(42.0);

    0 讨论(0)
提交回复
热议问题