C++ Official Operator Names / Keywords

Joseph Carras picture Joseph Carras · Dec 30, 2011 · Viewed 16.3k times · Source

Happy Holidays guys.

I have been working on a C++ preprocessor sequence (using boost) to assist me in generating operator based functors. I have so far completed the source, however I was having trouble finding the most appropriate keywords identifying these functors.

More specifically after reviewing the C++0x draft I failed to find the most appropriate (unique) names for the following operators:

  • -> and . which are both called in the draft: class member operators
  • ->* and .* which are both called: pointer to member operators

Do you think you can help me name them better?

The references I have used so for:

  1. The C++0x draft (Can be find online)
  2. The "boost/proto/operators.hpp" header which included most of the over-loadable operators.
  3. The Operators in C and C++ from Wikipedia which also provided the following names
    • . structure reference
    • -> structure dereference
    • ->* and .* member pointers

Here is the list I have so far created. Any other suggestions will be greatly appreciated.

 Symbol        Keyword           Description
++      , post_increment      , post increment
--      , post_decrement      , post decrement
++      , pre_increment       , pre increment
--      , pre_decrement       , pre decrement
+       , unary_plus          , additive promotion
-       , unary_minus         , additive inversion
!       , negate              , logical negation
~       , complement          , complement
*       , indirect            , indirection
&       , address_of          , address of
+       , add                 , addition
-       , subtract            , subtraction
*       , multiplies          , multiplication
/       , divides             , division
%       , modulus             , modulo
==      , equal               , equality
!=      , inequal             , inequality
>       , greater             , greater than
<       , less                , less than
>=      , greater_equal       , greater or equal than
<=      , less_equal          , less or equal than
&&      , logical_and         , logical and
||      , logical_or          , logical or
&       , bitwise_and         , bitwise and
|       , bitwise_or          , bitwise inclusive or
^       , bitwise_xor         , bitwise exclusive or
<<      , left_shift          , left shift
>>      , right_shift         , right shift
+=      , add_assign          , addition assignment
-=      , subtract_assign     , subtractions assignment
*=      , multiplies_assign   , multiplication assignment
/=      , divides_assign      , division assignment
%=      , modulus_assign      , modulo assignment
>>=     , right_shift_assign  , right shift assignment
<<=     , left_shift_assign   , left shift assignment
&=      , bitwise_and_assign  , bitwise and assignment
^=      , bitwise_or_assign   , bitwise exclusive or assignment
|=      , bitwise_or_assign   , bitwise inclusive or assignment
->*     , arrow_indirect      , pointer to member
,       , comma               , comma
=       , assign              , assignment
[]      , subscript           , subscription
->      , arrow               , class member
.       , dot                 , class member
.*      , dot_indirect        , pointer to member

Answer

GILGAMESH picture GILGAMESH · Dec 30, 2011

Try this reference.

New, delete, casting, I think there are some more operators and keywords there.