Open main menu

Difference between revisions of "Code Formatting Conventions"

→‎Whitespaces: clarify operator formatting (and some uppercase fixes)
(→‎Whitespaces: clarify operator formatting (and some uppercase fixes))
Line 85: Line 85:
'''Template definitions'''
'''Template definitions'''


no whitespace between template keyword and <
No whitespace between template keyword and <
<pre>
<pre>
template<typename foo>
template<typename foo>
Line 95: Line 95:
'''Operator overloading'''
'''Operator overloading'''


no whitespace between operator name and opening parentheses on definition (like with normal function/method definitions)
Operator keyword is NOT seperated from the name, except for type conversion operators where it is required
<pre>
<pre>
bool operator==(const MyType &l, const MyType &r) {
struct Foo {
    // ...
    bool operator()() {
        // ...
    }
 
    operator bool() {
        return true;
    }
}
}
</pre>
</pre>
561

edits