[Question] How to get beautiful and auto-formated ranges? #1634
kunaltyagi
started this conversation in
General
Replies: 1 comment 2 replies
-
Two trick I know of:
BreakBeforeBinaryOperators: All
auto test() {
return some_map //
| rv::filter([&](const auto &kv) { return kv.first == key; })
| rv::values //
| rv::filter([&](const auto &x) { return x % 2; });
} You can try this out here: |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My current clang-format configuration produces some ugly looking code, mainly because it splits the logic written using ranges in intuitive places.
Eg:
Does anyone have good tips for good-looking code? Any options in clang-format I should set?
Using NOLINT (via clang-format off/on) is tedious and using comments works, but it breaks the flow and defeats the purpose.
A sample clang-format that splits at
|
(doesn't matter if|
is end of line or start of new line) would be awesome.Beta Was this translation helpful? Give feedback.
All reactions