// External includes first, sorted by name.
#include <iostream>
#include <sstream>
// Internal includes second, sorted by name.
#include "../tapes/interfaces/reverseTapeInterface.hpp"
#include "../traits/realTraits.hpp"
/** \copydoc codi::Namespace */
namespace codi {
// One level of indentation corresponds to one tab.
// One tabs consists of 2 spaces.
// Everything in a namespace is indented once.
struct Test {
public: // Always use access specifier, access specifiers are indented.
int v; // Members are indented once again.
};
template<typename T_T> // Template parameters are declared with a 'T_' prefix
struct Test2 {
public:
using T = DECLARE_DEFAULT(T_T, int); // Template arguments are made available by `using` declarations without
// the 'T_'. A default type must be declared. ^
// |
// at most 120 characters in a line
};
struct Test3 {
public:
int constexpr m1; // const declarations are on the right hand side.
int const* m2; // const declarations are on the right hand side.
CODI_INLINE int const* func1(int const& offset) { // const declarations are on the right hand side.
return &m2[offset];
}
CODI_INLINE int func2(int& a) { // Pointer/reference symbol is part of the type.
return ++a;
}
};
CODI_INLINE void func(int& i) {
if (i > 0) { // Space between if and bracket.
while (i != 0) { // Space between while and bracket.
i -= 1;
}
} else {
switch (i) { // Space between switch and bracket.
case -1: // case statements are indented once.
i = 10; // case bodies are indented once more.
break;
case -2:
i = 100;
break;
default:
i = 0;
break;
}
}
for (int j = 0; j < 10; j += 1) { // Space between for and bracket.
i += j;
} // Always use curly brackets.
}
CODI_INLINE int func(
int a, // Arguments of multiline function declarations are indented twice.
int b,
int c
) { // Closing bracket is on a new line.
return a + b + c;
}
}