This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "Entity/Role/Role.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (condition) { // no spaces inside parentheses | |
... // 4 space indent. | |
} else if (...) { // The else goes on the same line as the closing brace. | |
... | |
} else { | |
... | |
} | |
// Sort conditional statements may be written on one line if this enhances readability. | |
if (x == kFoo) return new Foo(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
switch (var) { | |
case 0: // 4 space indent | |
... // 8 space indent | |
break; | |
case 1: | |
... | |
break; | |
default: | |
assert(false); // If the default case should never execute, simply assert | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( | |
this_one_thing > this_other_thing && | |
a_third_thing == a_fourth_thing && | |
yet_another && last_one | |
) { | |
... | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int x = 3; | |
int x(3); | |
int x{3}; | |
string name = "Some Name"; | |
string name("Some Name"); | |
string name{"Some Name"}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass : public OtherClass { | |
public: // Note the 0 space indent! | |
MyClass(); // Regular 4 space indent. | |
explicit MyClass(int var); | |
~MyClass() {} | |
void someFunction(); | |
void setSomeVar(int var); | |
int getSomeVar(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// When it all fits on one line: | |
MyClass::MyClass(int var) : some_var_(var), some_other_var_(var + 1) {} | |
// When it requires multiple lines, indent 4 spaces, putting the colon on | |
// the first initializer line: | |
MyClass::MyClass(int var) | |
: some_var_(var), // 4 space indent | |
some_other_var_(var + 1) { // lined up | |
... | |
DoSomething(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace { | |
void foo() { // Correct. No extra indentation within namespace. | |
... | |
} | |
} // namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% error output | |
% ============ | |
Normalizing Features ... | |
Running gradient descent ... | |
Theta computed from gradient descent: | |
334425.499894 | |
100131.267805 | |
3639.767537 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Octave console output | |
Cost at initial theta (zeros): 0.693147 | |
Gradient at initial theta (zeros): | |
-0.100000 | |
-12.009217 | |
-11.262842 |