New agent_body is sometimes a semicolon, an effective cut off muscles (§fourteen

New agent_body is sometimes a semicolon, an effective cut off muscles (§fourteen

.step 1 Standard

An user is actually an associate one represent this is from a keen phrase operator which are often applied to cases of the category. Providers was proclaimed having fun with operator_declarations:

6.1) otherwise a term muscles (§14.six.1). A cut-off human anatomy includes a block, and therefore specifies the comments to perform if driver are invoked. This new stop will adhere to the principles having worth-going back actions explained into the §14.6.11. An expression body consists of => with a term and you can an excellent semicolon, and you can denotes a single expression to do in the event the operator are invoked.

To own extern providers, the newest operator_muscles is made up only out of a semicolon. For all other providers, the driver_body’s possibly a great stop body or an expression system.

  • An agent declaration will tend to be both a public and you will a static modifier.
  • The fresh new parameter(s) out-of an user will don’t have any modifiers.
  • The latest signature regarding an operator (§.2, §.3, §.4) shall change from the fresh new signatures of all other operators elizabeth group.
  • All sorts referenced in the an agent report would be at the least once the available given that agent itself (§eight.5.5).
  • It is a mistake for similar modifier to seem several minutes within the an agent report.

Like many participants, operators stated from inside the a bottom classification is inherited by derived groups. As agent declarations constantly require category or struct where the newest driver was stated to sign up the brand new trademark of your user, this isn’t easy for an user announced within the a beneficial derived category to cover up an agent declared for the a bottom category. Therefore, the fresh new modifier has never been necessary, and this never permitted, for the an user statement.

.2 Unary workers

The second guidelines apply at unary driver declarations, where T indicates the fresh new such as for instance form of the category otherwise struct that has the brand new operator report:

, ++ , — , real , or false ) together with types of the new solitary authoritative parameter. The latest get back sorts of is not Burada yazınızı kontrol edin section of an excellent unary operator’s signature, nor ‘s the title of one’s official parameter.

The actual and you will not the case unary operators need couple-wise declaration. A secure-go out error occurs if the a class declares one of these workers versus also declaring another. The true and you will not the case workers was demonstrated further from inside the §.

Notice how the operator strategy productivity the benefits developed by including step one on operand, once the postfix increment and you will decrement workers (§11.7.14), and prefix increment and you can decrement workers (§eleven.8.6). Unlike from inside the C++, this method should not modify the worth of the operand privately as this do violate the standard semantics of your postfix increment user (§ end analogy

.3 Digital operators

The following regulations connect with digital operator declarations, where T denotes the latest eg version of the category or struct which has had the fresh new user statement:

  • A binary low-move operator will grab a couple of details, one or more from which will provides sort of T or T? , and will go back any type.
  • A binary << or >> operator (§) shall take two parameters, the first of which shall have type T or T? and the second of which shall have type int or int? , and can return any type. The signature of a binary operator consists of the operator token ( + , — , * , / , % , , | , ^ , << , >> , == , != , > , < , >= , or <= ) and the types of the two formal parameters. The return type and the names of the formal parameters are not part of a binary operator's signature.

Certain binary providers wanted pair-smart declaration. For each and every report out of possibly user out of a pair, here are a matching statement of the most other user out-of the two. Several driver declarations match if the label conversions exist ranging from their return versions as well as their involved factor brands. Next providers want partners-wise declaration: