Reputation: 135
This may be a very noobish question but what exactly is this called? I've seen
function()->
many times and never found out what it is called. Also how can I create my own?
GetDocument()->SetModifiedFlag(1);
Upvotes: 1
Views: 93
Reputation: 73376
If used for a function definition, it is called a return type declaration.
auto myfunctiona() -> int
{
return 0;
}
If it is used in an expression, it is the arrow operator which dereferences a pointer to access a member. In your example, the function GetDocument()
needs to return a pointer to an object. The type of that object must have a member function SetModifiedFlag()
.
Upvotes: 1
Reputation: 96126
This contsruction has no name, because there is nothing special about it.
It's just operator ->
applied to a value returned by function()
.
Upvotes: 8