| 1 | std::vector<std::string> |
| 2 | fn_with_many_parameters(int parm1, long parm2, float parm3, double parm4, |
| 3 | char* parm5, bool parm6); |
| 4 | |
| 5 | std::vector<std::string> |
| 6 | fn_with_many_parameters(int parm1, long parm2, float parm3, double parm4, |
| 7 | char* parm5, bool parm6) { |
| 8 | auto lambda = []() { |
| 9 | return 0; |
| 10 | }; |
| 11 | auto lambda_with_a_really_long_name_that_uses_a_whole_line |
| 12 | = [](int some_more_aligned_parameters, |
| 13 | std::string parm2) { |
| 14 | do_smth(); |
| 15 | }; |
| 16 | if (brace_on_same_line) { |
| 17 | do_smth(); |
| 18 | } else if (brace_on_next_line) |
| 19 | { |
| 20 | do_smth(); |
| 21 | } else if (another_condition) { |
| 22 | do_smth(); |
| 23 | } |
| 24 | else { |
| 25 | do_smth(); |
| 26 | } |
| 27 | if (inline_if_statement) |
| 28 | do_smth(); |
| 29 | if (another_inline_if_statement) |
| 30 | return [](int parm1, char* parm2) { |
| 31 | this_is_a_really_pointless_lambda(); |
| 32 | }; |
| 33 | |
| 34 | switch (var) { |
| 35 | case true: |
| 36 | return -1; |
| 37 | case false: |
| 38 | return 42; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | class MyClass : public MyBaseClass { |
| 43 | public: |
| 44 | MyClass(); |
| 45 | void public_fn(); |
| 46 | private: |
| 47 | super_secret_private_fn(); |
| 48 | } |
| 49 | |
| 50 | namespace geometry { |
| 51 | |
| 52 | template <typename T> |
| 53 | class Point { |
| 54 | public: |
| 55 | Point(T x, T y) : x_(x), y_(y) {} |
| 56 | |
| 57 | T sum() const { |
| 58 | return x_ + y_; |
| 59 | } |
| 60 | |
| 61 | private: |
| 62 | T x_; |
| 63 | T y_; |
| 64 | }; |
| 65 | |
| 66 | enum class Color { |
| 67 | Red, |
| 68 | Green, |
| 69 | Blue, |
| 70 | }; |
| 71 | |
| 72 | void iterate(const std::vector<int> &items) { |
| 73 | for (const auto &item : items) { |
| 74 | try { |
| 75 | process(item); |
| 76 | } catch (const std::exception &e) { |
| 77 | handle(e); |
| 78 | } |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | } // namespace geometry |
| 83 | |
| 84 | const char *raw = R"( |
| 85 | unindented |
| 86 | indented |
| 87 | )"; |