The agent_body is both an effective semicolon, a good cut-off looks (§fourteen

.step 1 General

An operator try a part one represent this is from a keen expression operator that can easily be used on instances of the class. Workers try announced playing with user_declarations:

six.1) or a phrase muscles (§14.6.1). A good cut off body includes an effective cut-off, and this specifies this new statements to execute in the event the user is actually invoked. Brand new block shall comply with the rules to have well worth-going back actions demonstrated for the §14.6.11. An expression system include => followed closely by a phrase and you may an effective semicolon, and you may denotes just one term to perform in the event the agent are invoked.

Having extern workers, the brand new driver_body comprise only out of an excellent semicolon. For everyone most other providers, the newest user_body is sometimes a block looks otherwise a phrase looks.

  • An operator report will were each other a community and you can a static modifier.
  • The fresh factor(s) away from an operator will have no modifiers.
  • The fresh signature from an operator (§.2, §.step 3, §.4) will change from the brand new signatures of all the other workers e category.
  • All types referenced inside a driver declaration will likely be at the least given that obtainable since the driver alone (§7.5.5).
  • It is a mistake for the very same modifier to look multiple minutes during the an user declaration.

Like many people, providers declared during the a base classification was passed on of the derived groups. Since the operator declarations always need the category otherwise struct where the brand new agent is actually declared to participate in this new signature of one's driver, that isn't possible for an user announced during the a great derived group to cover up an user stated during the a base class. Hence, the fresh modifier has never been necessary, and that never enabled, when you look at the an user declaration.

.dos Unary workers

The following rules apply to unary user declarations, in which T indicates this new such style of the course or struct who has the fresh operator statement:

, ++ , -- , true , otherwise not true ) additionally the variety of the newest solitary official factor. The newest return types of isn’t element of a unary operator's trademark, nor is the identity of your formal factor.

The true and you will incorrect unary workers require couples-smart statement. A compile-day error happen when the a class declares one of those workers versus in addition to declaring the other. The actual and you may not true providers are demonstrated next into the §.

Mention the user strategy production the value produced by adding step one into operand, because the postfix increment and decrement workers (§11.eight.14), while the prefix increment and you will decrement workers (§11.8.6). As opposed to from inside the C++, this procedure must not customize the value of their operand really because create violate the quality semantics of postfix increment operator (§eleven.eight.14). avoid analogy

.step 3 Binary providers

The second legislation affect binary operator declarations, in which T denotes brand new instance types of the course otherwise struct with brand new user statement:

  • A digital non-change user shall take several parameters, one or more at which should features kind of T or T? , and can 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 caribbean cupid indirim kodu 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.

Specific binary providers want couples-wise declaration. For each declaration out of sometimes agent away from some, indeed there shall be a corresponding report of your other operator away from the two. A couple of operator declarations match if the title conversions exists between its come back designs and their corresponding parameter designs. Next providers need couples-wise report: