The new agent_person is either a great semicolon, a stop human body (§fourteen - Atakan Oto Kurtarma

The new agent_person is either a great semicolon, a stop human body (§fourteen

The new agent_person is either a great semicolon, a stop human body (§fourteen

.step 1 General

An agent is actually a part one talks of the definition off a keen term user which are placed on cases of the category. Operators try proclaimed playing with agent_declarations:

six.1) or a term body (§fourteen.six.1). A beneficial stop muscles include a take off, and that determine the brand new comments to do if user are invoked. The fresh block should conform to the rules getting well worth-coming back tips described from inside the §14.6.eleven. A phrase looks contains => followed by an expression and an effective semicolon, and you can indicates one phrase to perform if the operator are invoked.

To own extern providers, the operator_human body consists only of a good semicolon. For all most other operators, the newest driver_person is either a great cut off muscles or a phrase muscles.

  • An agent report should include each other a general public and you may a fixed modifier.
  • The brand new factor(s) off an user should don’t have any modifiers.
  • The new signature out of an operator (§.2, §.step 3, §.4) shall range from the signatures of all other operators e category.
  • Every type referenced inside the an operator statement will likely be about since the obtainable since the driver itself (§eight.5.5).
  • It is a mistake for similar modifier to seem several times from inside the an operator statement.

Like many users, providers announced for the a base group was passed on from the derived kinds. Due to the fact agent declarations constantly need to have the classification otherwise struct in which brand new operator was proclaimed to sign up the fresh trademark of your user, it is not possible for an user declared during the a great derived category to full cover up an agent announced for the a base class. Therefore, the newest modifier has never been required, hence never permitted, inside a driver declaration.

.dos Unary workers

The second guidelines apply to unary agent declarations, where T denotes the like types of the class or struct with the fresh agent declaration:

, ++ , — , real , or incorrect ) together with brand of the new unmarried specialized factor. The go back type isn’t section of a unary operator’s signature, nor is the term of the formal factor.

The real and incorrect unary workers need partners-smart statement. A compile-time mistake happen in the event that a class announces one among these operators versus along with saying additional. The actual and false providers try explained further in the §.

Notice how the user means production the benefits developed by including step 1 on operand, just like the postfix increment and you may decrement providers (§eleven.eight.14), in addition to prefix increment and you will decrement workers (§eleven.8.6). As opposed to during the C++, this procedure ought not to modify the worth of its operand directly that manage violate the product quality semantics of your own postfix increment agent (§ avoid example

.3 Binary operators

The following laws and regulations apply at digital agent declarations, where T denotes the newest such type of the class otherwise struct that features new driver report:

  • A digital low-change agent shall need several parameters, a minumum of one at which will have type T or T? , and will come back any sort.
  • 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.

Specific digital operators wanted partners-wise statement. For each declaration regarding both operator out-of a pair, here shall be a matching report of other operator out-of the two. A few driver declarations matches in the event the title sales exists anywhere between the come back types in addition to their associated parameter items. The next workers need pair-wise report:

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir