Changes between Version 1 and Version 2 of Guidelines/Naming/Operators
- Timestamp:
- Mar 19, 2011, 5:42:19 PM (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Guidelines/Naming/Operators
v1 v2 1 1 = Operator Names = 2 2 3 This 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 14 The 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. 3 15 4 16 ||=` ` =||= type_traits =||= MUP =||= std =||= proto =||= boost::operator =|| … … 21 33 ||=`&&` =||logical_and ||logical_and || `?=` || `=` || || 22 34 ||=`||` =||logical_or ||logical_or || `?=` || `=` || || 23 ||=`&` =||bit_and ||bit wise_and|| `?=` || bitwise_* ||andable ||24 ||=`|` =||bit_or ||bit wise_or|| `?=` || bitwise_* ||orable ||25 ||=`^` =||bit_xor ||bit wise_xor|| `?=` || bitwise_* ||xorable ||35 ||=`&` =||bit_and ||bit_and || `?=` || bitwise_* ||andable || 36 ||=`|` =||bit_or ||bit_or || `?=` || bitwise_* ||orable || 37 ||=`^` =||bit_xor ||bit_xor || `?=` || bitwise_* ||xorable || 26 38 ||=`<<` =||left_shift ||left_shift || ||shift_left ||left_shiftable || 27 39 ||=`>>` =||right_shift ||right_shift || ||shift_right ||right_shiftable || 28 ||=`&=` =||bit_and_equal ||bit wise_and_assign || `?`||bitwise_and_assign || ||29 ||=`|=` =||bit_or_equal ||bit wise_or_assign || `?`||bitwise_or_assign || ||30 ||=`^=` =||bit_xor_equal ||bit wise_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 || || 31 43 ||=`<<=` =||left_shift_equal ||left_shift_assign || ||shift_left_assign || || 32 44 ||=`>>=` =||right_shift_equal ||right_shift_assign || ||shift_right_assign || || … … 35 47 ||=`+` =||unary_plus ||unary_plus || || `=` || || 36 48 ||=`-` =||unary_minus ||negate ||negate ||negate || || 37 ||=`!` =||logical_not ||logical_not || `?`||logical_not || ||49 ||=`!` =||logical_not ||logical_not || `?=` ||logical_not || || 38 50 ||=`~` =||complement ||complement ||compl ||complement || || 39 51 ||=`*` =||dereference ||dereference || ||dereference || || … … 41 53 ||=`--` =||postfix_decrement ||post_decrement || ||post_dec || || 42 54 43 55 56 There 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 63 A higher naming consitency could be reached, if the standard was changed for 3 names: 64 65 {{{ 66 #!c++ 67 // 20.8.7, bitwise operations: 68 template <class T> struct bit_and; 69 template <class T> struct bit_or; 70 template <class T> struct bit_xor; 71 }}} 72 73 In this case all the `bit` prefixes were replaced by `bitwise`. 74