auto lambda = [] () { return true };
auto lambda = [] () {
...;
};
socket.send([] () {
...;
});
socket.send([] () {
...
}).then([] () {
...
});
socket.send([
=,
&someLongCapture1,
&someLongCapture2,
&someLongCapture3,
&someLongCapture4] () {
...
});
socket.send([
=,
&someLongCapture1,
&someLongCapture2,
&someLongCapture3,
&someLongCapture4] () {
...
});
OR
socket.send(
[=, &someLongCapture1, &someLongCapture2, &someLongCapture3] (const T& arg) {
...
});
socket.send([
=,
&someLongCapture1,
&someLongCapture2,
someLongCapture3] mutable () {
...
});
OR
socket.send(
[=, &someLongCapture1, &someLongCapture2, someLongCapture3] mutable () {
...
});
socket.send([
=,
&someLongCapture,
&someLongCapture2,
&someLongCapture3] (const T& someParam) {
...
});
OR
socket.send([
=,
&someLongCapture,
&someLongCapture2,
&someLongCapture3] (
const T& someLongParam1,
const T& someLongParam2,
const T& someLongParam3) {
...
});
Last active
August 29, 2015 14:19
-
-
Save jmlvanre/b533778d65947205d316 to your computer and use it in GitHub Desktop.
lambda style
clang-format-3.5
int main()
{
auto lambda = []() { return true };
auto lambda = []() { s1; };
auto lambda = []() {
s1;
s2;
};
socket.send([]() { s1; });
socket.send([]() {
s1;
s2;
}).then([]() { s1; });
socket.send([]() {
s1;
s2;
}).then([]() {
s1;
s2;
});
socket.send([]() {
s1;
s2;
})
.then([]() {
s1;
s2;
})
.then([]() {
s1;
s2;
});
socket.send([=,
&someLongCapture1,
&someLongCapture2,
&someLongCapture3,
&someLongCapture4]() {
s1;
s2;
});
socket.send(
[=, &someLongCapture1, &someLongCapture2, someLongCapture3]() mutable {
s1;
s2;
});
socket.send(
[=, &someLongCapture1, &someLongCapture2, someLongCapture3]() mutable {
s1;
s2;
});
socket.send([=, &someLongCapture1, &someLongCapture2, &someLongCapture3](
const T& someParam) { s1; });
socket.send([=, &someLongCapture, &someLongCapture2, &someLongCapture3](
const T& someParam) {
s1;
s2;
});
socket.send([=, &someLongCapture, &someLongCapture2, &someLongCapture3](
const T& someLongParam1, const T& someLongParam2, const T& someLongParam3) {
s1;
s2;
s3;
});
}
clang-format-3.6
with BinPackArguments: false
which was introduced in 3.6.
int main()
{
auto lambda = []() { return true };
auto lambda = []() { s1; };
auto lambda = []() {
s1;
s2;
};
socket.send([]() { s1; });
socket.send([]() {
s1;
s2;
}).then([]() { s1; });
socket.send([]() {
s1;
s2;
})
.then([]() {
s1;
s2;
});
socket.send([]() {
s1;
s2;
})
.then([]() {
s1;
s2;
})
.then([]() {
s1;
s2;
});
socket.send([=,
&someLongCapture1,
&someLongCapture2,
&someLongCapture3,
&someLongCapture4]() {
s1;
s2;
});
socket.send(
[=, &someLongCapture1, &someLongCapture2, someLongCapture3]() mutable {
s1;
s2;
});
socket.send(
[=, &someLongCapture1, &someLongCapture2, someLongCapture3]() mutable {
s1;
s2;
});
socket.send([=, &someLongCapture1, &someLongCapture2, &someLongCapture3](
const T& someParam) { s1; });
socket.send([=, &someLongCapture, &someLongCapture2, &someLongCapture3](
const T& someParam) {
s1;
s2;
});
socket.send([=, &someLongCapture, &someLongCapture2, &someLongCapture3](
const T& someLongParam1, const T& someLongParam2, const T& someLongParam3) {
s1;
s2;
s3;
});
}
As discussed: I get the same results for both version.
A few more cases. Note that the known limitation of "jaggedness" is still present.
socket.send([=, &someLongCapture, &someLongCapture2, &someLongCapture3](
const T& someLongParam1,
const T& someLongParam2,
const T& someLongParam3,
const T& someLongParam4) {
s1;
s2;
s3;
});
socket.send([=, &someLongCapture](const T& someLongParam1,
const T& someLongParam2,
const T& someLongParam3,
const T& someLongParam4) {
s1;
s2;
s3;
});
socket.send([=,
&someLongCapture,
&someLongCapture2,
&someLongCapture3,
&someLongCapture4](const T& someLongParam1,
const T& someLongParam2,
const T& someLongParam3,
const T& someLongParam4) {
s1;
s2;
s3;
});
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mesos clang format style: Clang-format-3.5