Changes between Version 1 and Version 2 of Guidelines/Naming/Operators


Ignore:
Timestamp:
Mar 19, 2011, 5:42:19 PM (12 years ago)
Author:
Joachim Faulhaber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Guidelines/Naming/Operators

    v1 v2  
    11= Operator Names =
    22
     3This page has been created for the extention of Boost.TypeTraits by operator traits to ease an overview over existing naming of operators in the standards and boost libraries. The purpose of the page is to collect differences and support convergence.
     4
     5||=Column      =||=Comment  =||
     6||=type_traits =||boost::type_traits naming as proposed by Frédèric Bron. ||
     7||=MPU         =||Most Unifying Proposal ||
     8||=std         =|| ` =  :`  Equal naming in the standard ||
     9||=            =|| `?=  :`  Standard naming not unique. One variant is equal. ||
     10||=proto       =|| ` =  :`  Equal naming in boost::proto ||
     11||=            =|| `*_p :`  Partial equality except for a prefix or postfix ||
     12||=operator    =||Corresponding naming of concepts from boost::operator ||
     13
     14The names in column MPU are trying to minimize the differences between and so maximize the consistency. The naming from Boost.Proto is found in other boost libraries, e.g. accumulator.
    315
    416||=`  `  =||= type_traits       =||= MUP             =||= std    =||=  proto              =||= boost::operator     =||
     
    2133||=`&&`  =||logical_and          ||logical_and        ||  `?=`    ||   `=`                 ||                       ||
    2234||=`||`  =||logical_or           ||logical_or         ||  `?=`    ||   `=`                 ||                       ||
    23 ||=`&`   =||bit_and              ||bitwise_and        ||  `?=`    ||  bitwise_*            ||andable                ||
    24 ||=`|`   =||bit_or               ||bitwise_or         ||  `?=`    ||  bitwise_*            ||orable                 ||
    25 ||=`^`   =||bit_xor              ||bitwise_xor        ||  `?=`    ||  bitwise_*            ||xorable                ||
     35||=`&`   =||bit_and              ||bit_and            ||  `?=`    ||  bitwise_*            ||andable                ||
     36||=`|`   =||bit_or               ||bit_or             ||  `?=`    ||  bitwise_*            ||orable                 ||
     37||=`^`   =||bit_xor              ||bit_xor            ||  `?=`    ||  bitwise_*            ||xorable                ||
    2638||=`<<`  =||left_shift           ||left_shift         ||          ||shift_left             ||left_shiftable         ||
    2739||=`>>`  =||right_shift          ||right_shift        ||          ||shift_right            ||right_shiftable        ||
    28 ||=`&=`  =||bit_and_equal        ||bitwise_and_assign ||  `?`     ||bitwise_and_assign     ||                       ||
    29 ||=`|=`  =||bit_or_equal         ||bitwise_or_assign  ||  `?`     ||bitwise_or_assign      ||                       ||
    30 ||=`^=`  =||bit_xor_equal        ||bitwise_xor_assign ||  `?`     ||bitwise_xor_assign     ||                       ||
     40||=`&=`  =||bit_and_equal        ||bit_and_assign     ||and_eq    ||bitwise_and_assign     ||                       ||
     41||=`|=`  =||bit_or_equal         ||bit_or_assign      ||or_eq     ||bitwise_or_assign      ||                       ||
     42||=`^=`  =||bit_xor_equal        ||bit_xor_assign     ||xor_eq    ||bitwise_xor_assign     ||                       ||
    3143||=`<<=` =||left_shift_equal     ||left_shift_assign  ||          ||shift_left_assign      ||                       ||
    3244||=`>>=` =||right_shift_equal    ||right_shift_assign ||          ||shift_right_assign     ||                       ||
     
    3547||=`+`   =||unary_plus           ||unary_plus         ||          ||   `=`                 ||                       ||
    3648||=`-`   =||unary_minus          ||negate             ||negate    ||negate                 ||                       ||
    37 ||=`!`   =||logical_not          ||logical_not        || `?`      ||logical_not            ||                       ||
     49||=`!`   =||logical_not          ||logical_not        ||  `?=`    ||logical_not            ||                       ||
    3850||=`~`   =||complement           ||complement         ||compl     ||complement             ||                       ||
    3951||=`*`   =||dereference          ||dereference        ||          ||dereference            ||                       ||
     
    4153||=`--`  =||postfix_decrement    ||post_decrement     ||          ||post_dec               ||                       ||
    4254
    43  
     55
     56There are some conflicts that have been solved under these rationals:
     57
     58||`o=`      || op_equal vs. op_assign || proto and other boost::libs agree on `op_assign`. We can better conceptify to OpAssignable ||
     59||          || bit vs. bitwise        || bitwise seems to be more "natural" but some naming in the standard prefers bit_ prefix     ||
     60||`<< >>`   || shift_xxx or xxx_shift || goes to xxx_shift, because we can conceptify to xxx_shiftable more nicely. ||
     61||`++ --`   || pre/postfix vs. pre/post || goes to pre_in/decrement post_in/decrement. Seems simpler and more natural. ||
     62
     63A higher naming consitency could be reached, if the standard was changed for 3 names:
     64
     65{{{
     66#!c++
     67// 20.8.7, bitwise operations:
     68template <class T> struct bit_and;
     69template <class T> struct bit_or;
     70template <class T> struct bit_xor;
     71}}}
     72
     73In this case all the `bit` prefixes were replaced by `bitwise`.
     74