Я видел много примеров кодов на cppreference. Например, следующий URL имеет один код:
https://en.cppreference.com/w/cpp/language/list_initialization
Из приведенного выше примера мы можем заметить, что отступ для фигурных скобок отличается от struct
и function
следующим образом.
struct Foo { // left-brace is on the same line with the name of the struct
std::vector<int> mem = {1, 2, 3}; // default indent seems 4 spaces
std::vector<int> mem2;
Foo() : mem2{-1, -2, -3} {}
}; // right-brace starts with a new line
std::pair<std::string, std::string> f(std::pair<std::string, std::string> p)
{ // left-brace starts with a new line for function
return {p.second, p.first}; // list-initialization in return statement
} // right-brace starts with a new line for function
int main()
{ // same as above
//...
} // same as above
Где описан стиль кодирования?