Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Operators in C and C++
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Operators== In the following tables, lower case letters such as <code>a</code> and <code>b</code> represent literal values, object/variable names, or l-values, as appropriate. <code>R</code>, <code>S</code> and <code>T</code> stand for a data type, and <code>K</code> for a class or enumeration type. Some operators have alternative spellings using [[digraphs and trigraphs (programming)|digraphs and trigraphs]] or [[#Synonyms|operator synonyms]]. ===Arithmetic=== C and C++ have the same arithmetic operators and all can be overloaded in C++. {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | [[Addition]] | align="center" | {{nowrap| 1=<code>a '''+''' b</code>}} | {{cpp|1=R K::operator +(S b);}} | {{cpp|1=R operator +(K a, S b);}} |- | {{rh}} colspan="2" | [[Subtraction]] | align="center" | <code>a '''-''' b</code> | {{cpp|1=R K::operator -(S b);}} | {{cpp|1=R operator -(K a, S b);}} |- | {{rh}} colspan="2" | [[Unary operation|Unary]] plus; [[Type conversion#Type promotion|integer promotion]] |align="center" | <code>'''+'''a</code> | {{cpp|1=R K::operator +();}} | {{cpp|1=R operator +(K a);}} |- | {{rh}} colspan="2" | [[Unary operation|Unary]] minus; [[additive inverse]] | align="center" | <code>'''-'''a</code> | {{cpp|1=R K::operator -();}} | {{cpp|1=R operator -(K a);}} |- | {{rh}} colspan="2" | [[Multiplication]] | align="center" | <code>a '''*''' b</code> | {{cpp|1=R K::operator *(S b);}} | {{cpp|1=R operator *(K a, S b);}} |- | {{rh}} colspan="2" | [[Division (mathematics)|Division]] | align="center" | <code>a '''/''' b</code> | {{cpp|1=R K::operator /(S b);}} | {{cpp|1=R operator /(K a, S b);}} |- | {{rh}} colspan="2" | [[Modulo operation|Modulo]]<ref name="modulo" group="lower-alpha" /> | align="center" | <code>a '''%''' b</code> | {{cpp|1=R K::operator %(S b);}} | {{cpp|1=R operator %(K a, S b);}} |- | {{rh}} colspan="2" | Prefix [[Increment and decrement operators|increment]] | align="center" | <code>'''++'''a</code> | {{cpp|1=R& K::operator ++();}} | {{cpp|1=R& operator ++(K& a);}} |- | {{rh}} colspan="2" | Postfix increment | align="center" | <code>a'''++'''</code> | {{cpp|1=R K::operator ++(int);}}{{efn|name=dummy-int|The {{cpp|int}} is a dummy parameter to differentiate between prefix and postfix.}} | {{cpp|1=R operator ++(K& a, int);}}{{efn|name=dummy-int}} |- | {{rh}} colspan="2" | Prefix [[Increment and decrement operators|decrement]] | align="center" | <code>'''--'''a</code> | {{cpp|1=R& K::operator --();}} | {{cpp|1=R& operator --(K& a);}} |- | {{rh}} colspan="2" | Postfix decrement | align="center" | <code>a'''--'''</code> | {{cpp|1=R K::operator --(int);}}{{efn|name=dummy-int}} | {{cpp|1=R operator --(K& a, int);}}{{efn|name=dummy-int}} |} ===Relational=== All [[Relational operator|relational]] (comparison) operators can be overloaded in C++. Since [[C++20]], the inequality operator is automatically generated if <code>operator==</code> is defined and all four relational operators are automatically generated if <code>operator<=></code> is defined.<ref>{{cite web|url=https://en.cppreference.com/w/cpp/language/operators#Comparison_operators|title=Operator overloading§Comparison operators|website=cppreference.com}}</ref> {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! rowspan="2" | In C ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | Equal to | align="center" | <code>a '''==''' b</code> | {{yes}} | {{cpp|1=bool K::operator ==(S const& b) const;}} | {{cpp|1=bool operator ==(K const& a, S const& b);}} |- | {{rh}} colspan="2" | Not equal to | style="text-align:center;" | <code>a '''!=''' b</code> || {{yes}} | {{cpp|1=bool K::operator !=(S const& b) const;}} | {{cpp|1=bool operator !=(K const& a, S const& b);}} |- | {{rh}} colspan="2" | Greater than | style="text-align:center;" | <code>a '''>''' b</code> || {{yes}} | {{cpp|1=bool K::operator >(S const& b) const;}} | {{cpp|1=bool operator >(K const& a, S const& b);}} |- | {{rh}} colspan="2" | Less than | style="text-align:center;" | <code>a '''<''' b</code> || {{yes}} | {{cpp|1=bool K::operator <(S const& b) const;}} | {{cpp|1=bool operator <(K const& a, S const& b);}} |- | {{rh}} colspan="2" | Greater than or equal to | style="text-align:center;" | <code>a '''>=''' b</code> || {{yes}} | {{cpp|1=bool K::operator >=(S const& b) const;}} | {{cpp|1=bool operator >=(K const& a, S const& b);}} |- | {{rh}} colspan="2" | Less than or equal to | style="text-align:center;" | <code>a '''<=''' b</code> || {{yes}} | {{cpp|1=bool K::operator <=(S const& b) const;}} | {{cpp|1=bool operator <=(K const& a, S const& b);}} |- | {{rh}} colspan="2" | [[Three-way comparison]]<ref name="threewaycomparison" group="lower-alpha"/>{{efn|Possible return types: <code>std::weak_ordering</code>, <code>std::strong_ordering</code> and <code>std::partial_ordering</code> to which they all are convertible to.}} | style="text-align:center;" | <code>a '''<=>''' b</code> || {{no}} | {{cpp|1=auto K::operator <=>(const S &b);}} | {{cpp|1=auto operator <=>(const K &a, const S &b);}} |} ===Logical=== C and C++ have the same logical operators and all can be overloaded in C++. Note that overloading logical ''AND'' and ''OR'' is discouraged, because as overloaded operators they always evaluate both operands instead of providing the normal semantics of [[short-circuit evaluation]].<ref>{{Cite web|url=https://isocpp.org/wiki/faq/operator-overloading|title=Standard C++}}</ref> {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | [[Negation|NOT]] | align="center" | <code>'''!'''a</code> | {{cpp|1=bool K::operator !();}} | {{cpp|1=bool operator !(K a);}} |- | {{rh}} colspan="2" | [[Logical conjunction|AND]] | style="text-align:center;" | <code>a '''&&''' b</code> | {{cpp|1=bool K::operator &&(S b);}} | {{cpp|1=bool operator &&(K a, S b);}} |- | {{rh}} colspan="2" | [[Logical disjunction|OR]] | style="text-align:center;" | <code>a '''<nowiki>||</nowiki>''' b</code> | {{code|1=bool K::operator {{!!}}(S b);|lang=cpp}} | {{code|1=bool operator {{!!}}(K a, S b);|lang=cpp}} |} ===Bitwise=== C and C++ have the same bitwise operators and all can be overloaded in C++. {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | [[Bitwise operation#NOT|NOT]] | align="center" | <code>'''~'''a</code><br/> | {{cpp|1=R K::operator ~();}} | {{cpp|1=R operator ~(K a);}} |- | {{rh}} colspan="2" | [[Bitwise operation#AND|AND]] | style="text-align:center;" | <code>a '''&''' b</code> | {{cpp|1=R K::operator &(S b);}} | {{cpp|1=R operator &(K a, S b);}} |- | {{rh}} colspan="2" | [[Bitwise operation#OR|OR]] | style="text-align:center;" | <code>a '''<nowiki>|</nowiki>''' b</code> | {{cpp|1=R K::operator {{!}}(S b);|lang=cpp}} | {{cpp|1=R operator {{!}}(K a, S b);|lang=cpp}} |- | {{rh}} colspan="2" | [[Bitwise operation#XOR|XOR]] | style="text-align:center;" | <code>a '''^''' b</code> | {{cpp|1=R K::operator ^(S b);}} | {{cpp|1=R operator ^(K a, S b);}} |- | {{rh}} colspan="2" | [[Bitwise shift|Shift]] left<ref name="bitshift" group="lower-alpha" /> | style="text-align:center;" | <code>a '''<<''' b</code> | {{cpp|1=R K::operator <<(S b);}} | {{cpp|1=R operator <<(K a, S b);}} |- | {{rh}} colspan="2" | Shift right<ref name="bitshift" group="lower-alpha" />{{Refn | Operation="rightbitshift" | group="lower-alpha" | According to the C99 standard, the right shift of a negative number is implementation defined. Most implementations, e.g., the GCC,<ref name="Integers">{{Citation | contribution = Integers implementation | url = //gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Integers-implementation.html#Integers-implementation | title = GCC 4.3.3 | publisher = GNU}}.</ref> use an [[arithmetic shift]] (i.e., sign extension), but a [[logical shift]] is possible.}} | style="text-align:center;" | <code>a '''>>''' b</code> | {{cpp|1=R K::operator >>(S b);}} | {{cpp|1=R operator >>(K a, S b);}} |} ===Assignment=== C and C++ have the same assignment operators and all can be overloaded in C++. For the combination operators, <code>a ⊚= b</code> (where <code>⊚</code> represents an operation) is equivalent to <code>a = a ⊚ b</code>, except that <code>a</code> is evaluated only once. {| class="wikitable" style="width:100%" ! rowspan="2" | Operation ! rowspan="2" | Syntax ! colspan="2" | C++ prototype |- ! in class K ! outside class |- ! {{rh}} | [[Assignment operator (C++)|Assignment]] | style="text-align:center;" | {{nowrap| 1=<code>a '''=''' b</code>}} | {{cpp|1=R& K::operator =(S b);}} | {{n/a}} |- ! {{rh}} | Addition combination | align="center" | <code>a '''+=''' b</code> | {{cpp|1=R& K::operator +=(S b);}} | {{cpp|1=R& operator +=(K& a, S b);}} |- ! {{rh}} | Subtraction combination | style="text-align:center;" | <code>a '''-=''' b</code> | {{cpp|1=R& K::operator -=(S b);}} | {{cpp|1=R& operator -=(K& a, S b);}} |- ! {{rh}} | Multiplication combination | style="text-align:center;" | <code>a '''*=''' b</code> | {{cpp|1=R& K::operator *=(S b);}} | {{cpp|1=R& operator *=(K& a, S b);}} |- ! {{rh}} | Division combination | style="text-align:center;" | <code>a '''/=''' b</code> | {{cpp|1=R& K::operator /=(S b);}} | {{cpp|1=R& operator /=(K& a, S b);}} |- ! {{rh}} | Modulo combination | style="text-align:center;" | <code>a '''%=''' b</code> | {{cpp|1=R& K::operator %=(S b);}} | {{cpp|1=R& operator %=(K& a, S b);}} |- ! {{rh}} | Bitwise AND combination | style="text-align:center;" | <code>a '''&=''' b</code> | {{cpp|1=R& K::operator &=(S b);}} | {{cpp|1=R& operator &=(K& a, S b);}} |- ! {{rh}} | Bitwise OR combination | style="text-align:center;" | <code>a '''<nowiki>|</nowiki>=''' b</code> | {{cpp|1=R& K::operator {{!}}=(S b);|lang=cpp}} | {{cpp|1=R& operator {{!}}=(K& a, S b);|lang=cpp}} |- ! {{rh}} | Bitwise XOR combination | style="text-align:center;" | <code>a '''^=''' b</code> | {{cpp|1=R& K::operator ^=(S b);}} | {{cpp|1=R& operator ^=(K& a, S b);}} |- ! {{rh}} | Bitwise left shift combination | style="text-align:center;" | <code>a '''<<=''' b</code> | {{cpp|1=R& K::operator <<=(S b);}} | {{cpp|1=R& operator <<=(K& a, S b);}} |- ! {{rh}} | Bitwise right shift combination{{Refn | name="rightbitshift" | group="lower-alpha" | According to the C99 standard, the right shift of a negative number is implementation defined. Most implementations, e.g., the GCC,<ref name="Integers">{{Citation | contribution = Integers implementation | url = //gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Integers-implementation.html#Integers-implementation | title = GCC 4.3.3 | publisher = GNU}}.</ref> use an [[arithmetic shift]] (i.e., sign extension), but a [[logical shift]] is possible.}} | style="text-align:center;" | <code>a '''>>=''' b</code> | {{cpp|1=R& K::operator >>=(S b);}} | {{cpp|1=R& operator >>=(K& a, S b);}} |} ===Member and pointer=== {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! rowspan="2" | Can overload ! rowspan="2" | In C ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | [[Indexer (programming)|Subscript]] | align="center" | <code>a'''['''b''']'''</code><code>a'''<:'''b''':>'''</code><ref>{{Cite web |title=ISO/IEC 9899:1999 specification, TC3 |url=https://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf#%5B%7B%22num%22%3A148%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C-27%2C816%2Cnull%5D |at=p. 64, § 6.4.6 ''Ponctuators'' para. 3}}</ref> | {{yes}} | {{yes}} | {{cpp|1=R& K::operator [](S b);}}<br/>{{cpp|1=R& K::operator [](S b, ...);}}<ref name="sinceCXX23" group="lower-alpha" /> | {{n/a}} |- | {{rh}} colspan="2" | Indirection <br>{{small|(object pointed to by ''a'')}} | style="text-align:center;" | <code>'''*'''a</code> || {{yes}} || {{yes}} | {{cpp|1=R& K::operator *();}} | {{cpp|1=R& operator *(K a);}} |- | {{rh}} colspan="2" | Address-of <br>{{small|(address of ''a'')}} | style="text-align:center;" | <code>'''&'''a</code> || {{yes}}<ref name="addressof2" group="lower-alpha"/> || {{yes}} | {{cpp|1=R* K::operator &();}} | {{cpp|1=R* operator &(K a);}} |- | {{rh}} colspan="2" | Structure dereference <br>{{small|(member ''b'' of object pointed to by ''a'')}} | style="text-align:center;" | <code>a'''->'''b</code> || {{yes}} || {{yes}} | {{cpp|1=R* K::operator ->();}}<ref name="arrowptr" group="lower-alpha" /><br /> | {{n/a}} |- | {{rh}} colspan="2" | Structure reference <br>{{small|(member ''b'' of object ''a'')}} | style="text-align:center;" | <code>a'''.'''b</code> || {{no}} || {{yes}} | {{rh}} colspan="2" {{n/a}} |- | {{rh}} colspan="2" | Member selected by [[pointer-to-member]] ''b'' of object pointed to by ''a''<ref name="arrowstar" group="lower-alpha" /> | style="text-align:center;" | <code>a'''->*'''b</code> || {{yes}} || {{no}} | {{cpp|1=R& K::operator ->*(S b);}} | {{cpp|1=R& operator ->*(K a, S b);}} |- | {{rh}} colspan="2" | Member of object ''a'' selected by [[pointer-to-member]] ''b'' | style="text-align:center;" | <code>a'''.*'''b</code> || {{no}} || {{no}} | {{rh}} colspan="2" {{n/a}} |} ===Other=== {| class="wikitable" style="width:100%" ! colspan="2" rowspan="2" | Operation ! rowspan="2" | Syntax ! rowspan="2" | Can overload ! rowspan="2" | In C ! colspan="2" | C++ prototype |- ! in class K ! outside class |- | {{rh}} colspan="2" | [[function (programming)|Function]] call | align="center" | <code>a'''('''a1, a2''')'''</code> | {{yes}} | {{yes}} | {{cpp|1=R K::operator ()(S a, T b, ...);}}<!--'operator' shows as blue even though other prototypes shows it as green; seems to be a bug in the cpp template; unknown how to workaround.--> | {{n/a}} |- | {{rh}} colspan="2" | [[comma operator|Comma]] | style="text-align:center;" | <code>a''',''' b</code> || {{yes}} || {{yes}} | {{cpp|1=R K::operator ,(S b);}} | {{cpp|1=R operator ,(K a, S b);}} |- | {{rh}} colspan="2" | [[?:|Ternary conditional]] | style="text-align:center;" | <code>a '''?''' b ''':''' c</code> || {{no}} || {{yes}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[Scope resolution operator#C++|Scope resolution]] | style="text-align:center;" | <code>a'''::'''b</code><ref name="scopal" group="lower-alpha" /> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | User-defined literals<ref name="ud-literal" group="lower-alpha" /><ref name="sinceCXX11" group="lower-alpha" /> | style="text-align: center;" | <code><nowiki>"a"_b</nowiki></code> || {{yes}} || {{no}} | {{n/a}} | {{cpp|1=R operator "" _b(T a)}} |- | {{rh}} colspan="2" | [[Sizeof]] | style="text-align:center;" | <code>'''sizeof''' a</code><ref name="sizeof" group="lower-alpha" /><br /><code>'''sizeof''' (R)</code> || {{no}} || {{yes}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | Size of [[variadic template|parameter pack]]<ref name="sinceCXX11" group="lower-alpha" /> | style="text-align:center;" | <code>'''sizeof...'''(Args)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | Alignof<ref name="sinceCXX11" group="lower-alpha" /> | style="text-align:center;" | <code>'''alignof'''(R)</code> <br> or <code>'''_Alignof'''(R)</code><ref name="alignof" group="lower-alpha"/> || {{no}} || {{yes}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[Decltype]]<ref name="sinceCXX11" group="lower-alpha" /> | style="text-align:center;" | <code>'''decltype''' (a)</code><br/><code>'''decltype''' (R)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | Type identification | style="text-align:center;" | <code>'''typeid'''(a)</code><br><code>'''typeid'''(R)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[type conversion|Conversion]]<br>{{small|(C-style cast)}} | style="text-align:center;" | <code>(R)a</code> || {{yes}} || {{yes}} | {{cpp|1=K::operator R();}}<ref>{{cite web|url=https://en.cppreference.com/w/cpp/language/cast_operator|title=user-defined conversion|access-date=5 April 2020}}</ref> | {{n/a}} |- | {{rh}} colspan="2" | [[type conversion|Conversion]]{{efn|Behaves like const_cast/static_cast/reinterpret_cast. In the last two cases, the <code>auto</code> specifier is replaced with the type of the invented variable x declared with <code>auto x(a);</code> (which is never interpreted as a function declaration) or <code>auto x{a};</code>, respectively.}}<ref>[https://en.cppreference.com/w/cpp/language/explicit_cast Explicit type conversion] in C++</ref> | style="text-align:center;" | <code>R(a)</code><br><code>R{a}</code><ref name="sinceCXX11" group="lower-alpha" /><br><code>auto(a)</code><ref name="sinceCXX23" group="lower-alpha" /><br><code>auto{a}</code><ref name="sinceCXX23" group="lower-alpha" /> || {{no}} || {{no}} | {{rh}} colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[static_cast]] conversion{{efn|For user-defined conversions, the return type implicitly and necessarily matches the operator name unless the type is inferred (e.g. {{cpp|1=operator auto()}}, {{cpp|1=operator decltype(auto)()}} etc.).}} | style="text-align:center;" | <code>'''static_cast'''<R>(a)</code> || {{yes}} || {{no}} | {{cpp|1=K::operator R();}}<br>{{cpp|1=explicit K::operator R();}}<ref name="sinceCXX11" group="lower-alpha" /> | {{n/a}} |- | {{rh}} colspan="2" | [[dynamic cast]] conversion | style="text-align:center;" | <code>'''dynamic_cast'''<R>(a)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[const_cast]] conversion | style="text-align:center;" | <code>'''const_cast'''<R>(a)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[reinterpret_cast]] conversion | style="text-align:center;" | <code>'''reinterpret_cast'''<R>(a)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |- | {{rh}} colspan="2" | [[new (c++)|Allocate storage]] | style="text-align:center;" | <code>'''new''' R</code><ref name="infer" group="lower-alpha"/> || {{yes}} || {{no}} | {{cpp|1=void* K::operator new(size_t x);}} | {{cpp|1=void* operator new(size_t x);}} |- | {{rh}} colspan="2" | Allocate array | style="text-align:center;" | <code>'''new''' R'''['''n''']'''</code><ref name="infer2" group="lower-alpha"/> || {{yes}} || {{no}} | {{cpp|1=void* K::operator new[](size_t a);}} | {{cpp|1=void* operator new[](size_t a);}} |- | {{rh}} colspan="2" | [[operator delete|Deallocate storage]] | style="text-align:center;" | <code>'''delete''' a</code> || {{yes}} || {{no}} | {{cpp|1=void K::operator delete(void* a);}} | {{cpp|1=void operator delete(void* a);}} |- | {{rh}} colspan="2" | Deallocate array | style="text-align:center;" | <code>'''delete[]''' a</code> || {{yes}} || {{no}} | {{cpp|1=void K::operator delete[](void* a);}} | {{cpp|1=void operator delete[](void* a);}} |- | {{rh}} colspan="2" | Exception check<ref name="sinceCXX11" group="lower-alpha" /> | style="text-align:center;" | <code>'''noexcept'''(a)</code> || {{no}} || {{no}} | colspan="2" {{n/a}} |} === Synonyms === C++ defines keywords to act as aliases for a number of operators:<ref name="Committee">{{cite book | title = ISO/IEC 14882:1998(E) Programming Language C++ | date = 1 September 1998 | publisher = open-std.org – The C++ Standards Committee | pages = 40–41}}</ref> {| class="wikitable" style="width:30%; text-align:center;" ! Keyword || Operator |- | {{code|and}} || <code>&&</code> |- | {{code|and_eq}} || <code>&=</code> |- | {{code|bitand}} || <code>&</code> |- | {{code|bitor}} || <code>|</code> |- | {{code|compl}} || <code>~</code> |- | {{code|not}} || <code>!</code> |- | {{code|not_eq}} || <code>!=</code> |- | {{code|or}} || <code>||</code> |- | {{code|or_eq}} || <code>|=</code> |- | {{code|xor}} || <code>^</code> |- | {{code|xor_eq}} || <code>^=</code> |} Each keyword is a different way to specify an operator and as such can be used instead of the corresponding symbolic variation. For example, {{code|1=(a > 0 and not flag)}} and {{code|1=(a > 0 && !flag)}} specify the same behavior. As another example, the <code>bitand</code> keyword may be used to replace not only the ''bitwise-and'' operator but also the ''address-of'' operator, and it can be used to specify reference types (e.g., {{code|1=int bitand ref = n}}). The ISO C specification makes allowance for these keywords as preprocessor macros in the header file [[iso646.h|{{code|iso646.h}}]]. For compatibility with C, C++ also provides the header {{code|iso646.h}}, the inclusion of which has no effect. Until C++20, it also provided the corresponding header [[ciso646|{{code|ciso646}}]] which had no effect as well.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)