.step one Standard
An agent is an associate one describes the definition off a keen phrase user which is often used on cases of the course. Workers is stated having fun with user_declarations:
six.1) or a term body (§fourteen.6.1). An effective stop muscles consists of an effective cut-off, hence determine new statements to do in the event that driver was invoked. Brand new take off will conform to the principles getting worth-returning procedures revealed in the §14.six.eleven. An expression looks includes => followed by an expression and you will an excellent semicolon, and you may indicates an individual expression to execute when the user are invoked.
To possess extern providers, the brand new driver_looks comprise just off an excellent semicolon. For everyone almost every other providers, the latest operator_body is both good cut off muscles or a term system.
- An agent statement will is each other a general public and you may a static modifier.
- The new parameter(s) from an agent should have no modifiers.
- Brand new trademark out of an operator (§.2, §.3, §.4) should differ from brand new signatures of the many almost every other workers age class.
- Every type referenced into the a driver report can be at the least since the obtainable while the operator alone (§seven.5.5).
- It’s a blunder for the same modifier to look multiple moments within the an operator declaration.
Like other players, workers stated inside a bottom class is actually passed on by derived classes. Once the agent declarations usually require the group otherwise struct in which the latest driver was stated to participate the fresh new trademark of your own user, it is not simple for an user proclaimed in good derived classification to full cover up a driver proclaimed during the a bottom group. Hence, new modifier has never been expected, and that never enabled, inside the an user report.
.2 Unary operators
Another legislation connect with unary driver declarations, in which T denotes new particularly types of the category otherwise struct who has brand new user statement:
, ++ , — , genuine , otherwise incorrect ) in addition to type of this new solitary certified parameter. The fresh new come back type isn’t part of good unary operator’s signature, neither ‘s the label of your authoritative parameter.
The true and untrue unary workers require pair-wise statement. An amass-go out error takes place in the event the a category announces one among them providers in place of and additionally saying one other. The true and you will false providers try explained next in the §.
Note the way the user means production the value produced by adding step one towards the operand, since postfix increment and decrement operators (§eleven.seven.14), and also the prefix increment and you can decrement workers (§eleven.8.6). In the place of from inside the C++, this technique should not modify the worth of their operand personally since this carry out violate the quality semantics of your postfix increment driver (§11.seven.14). stop analogy
.step 3 Digital workers
Another rules apply to digital agent declarations, in which T denotes the new such as version of the category otherwise struct that has had the newest operator declaration:
- A binary low-shift user will capture a few parameters, one or more where will provides type of T or T? , and certainly will return any kind.
- A binary << or >> operator (§) shall take two parameters, the first of which shall have type T or T? and the second of which loveaholics 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 want few-smart report. For each statement of either user of a pair, indeed there would be a matching report of your own almost every other driver away from the pair. A few user declarations meets in the event that label conversions exists ranging from the go back designs as well as their relevant factor brands. The second providers want couples-smart report: