I'm reading boost documentation and see the following at http://www.boost.org/doc/libs/1_54_0/doc/html/lambda/le_in_details.html :
Operators that cannot be overloaded
Some operators cannot be overloaded at all (::, ., .*). For some operators, the requirements on return types prevent them to be overloaded to create lambda functors. These operators are ->., ->, new, new[], delete, delete[] and ?: (the conditional operator).
So what is the operator ->.
? I tried Google and http://www.symbolhound.com/ but didn't get anything useful, searching on N3337 gives 1 result that is ->
at the end of a sentence, and Visual Studio 2012 won't compile:
class xT {
bool operator ->. () {} /* fail */
};
std::string* p;
p->.size(); /* fail */
std::auto_ptr<std::string> a;
a->.size(); /* fail */
I believe the author intentionally wrote ->.
since ->
and .
is also included, but what is ->.
, or why it is here?
The -> is called the arrow operator. It is formed by using the minus sign followed by a greater than sign. Simply saying: To access members of a structure, use the dot operator. To access members of a structure through a pointer, use the arrow operator.
The -> (arrow) operator is used to access class, structure or union members using a pointer. A postfix expression, followed by an -> (arrow) operator, followed by a possibly qualified identifier or a pseudo-destructor name, designates a member of the object to which the pointer points.
Difference between Dot(.)operator is used to normally access members of a structure or union. The Arrow(->) operator exists to access the members of the structure or the unions using pointers.
IT seems to be a typo.
In the C++ draft 3690, there is no mention about an operator ->.
.
It could be the ->*
:
5.5 Pointer-to-member operators [expr.mptr.oper]
The pointer-to-member operators
->*
and.*
group left-to-right.
And in http://www.boost.org/doc/libs/1_54_0/doc/html/lambda/le_in_details.html, they have some example with this operator.
As you can see from C++11, 2.13: "Operators and punctuators", there is no such operator as "->.
".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With