C++ lambda syntax
I have a function that searches a vector of iterators and returns the iterator if its names matches a string passed as an argument.
koalaGraph::PVertex lookUpByName(std::string Name, std::vector<koalaGraph::PVertex>& Vertices) {
for (size_t i = 0; i < Vertices.size(); i++) {
if(Vertices[i]->info.name == Name)
return Vertices[i];
}
}
My question is how can I implement this as a lambda, to use it in connection with std::find_if
?
I'm trying this:
std::vector<koalaGraph::PVertex> V;
std::string Name;
std::find_if(V.begin(), V.end(), [&Name]() {return Name == V->info.name;})
But it says that V
an enclosing-function local variable cannot be referenced in a lambda body unless it is in the capture list.
c++ lambda
New contributor
add a comment |
I have a function that searches a vector of iterators and returns the iterator if its names matches a string passed as an argument.
koalaGraph::PVertex lookUpByName(std::string Name, std::vector<koalaGraph::PVertex>& Vertices) {
for (size_t i = 0; i < Vertices.size(); i++) {
if(Vertices[i]->info.name == Name)
return Vertices[i];
}
}
My question is how can I implement this as a lambda, to use it in connection with std::find_if
?
I'm trying this:
std::vector<koalaGraph::PVertex> V;
std::string Name;
std::find_if(V.begin(), V.end(), [&Name]() {return Name == V->info.name;})
But it says that V
an enclosing-function local variable cannot be referenced in a lambda body unless it is in the capture list.
c++ lambda
New contributor
1
Noreturn
if nothing found?
– Deduplicator
yesterday
add a comment |
I have a function that searches a vector of iterators and returns the iterator if its names matches a string passed as an argument.
koalaGraph::PVertex lookUpByName(std::string Name, std::vector<koalaGraph::PVertex>& Vertices) {
for (size_t i = 0; i < Vertices.size(); i++) {
if(Vertices[i]->info.name == Name)
return Vertices[i];
}
}
My question is how can I implement this as a lambda, to use it in connection with std::find_if
?
I'm trying this:
std::vector<koalaGraph::PVertex> V;
std::string Name;
std::find_if(V.begin(), V.end(), [&Name]() {return Name == V->info.name;})
But it says that V
an enclosing-function local variable cannot be referenced in a lambda body unless it is in the capture list.
c++ lambda
New contributor
I have a function that searches a vector of iterators and returns the iterator if its names matches a string passed as an argument.
koalaGraph::PVertex lookUpByName(std::string Name, std::vector<koalaGraph::PVertex>& Vertices) {
for (size_t i = 0; i < Vertices.size(); i++) {
if(Vertices[i]->info.name == Name)
return Vertices[i];
}
}
My question is how can I implement this as a lambda, to use it in connection with std::find_if
?
I'm trying this:
std::vector<koalaGraph::PVertex> V;
std::string Name;
std::find_if(V.begin(), V.end(), [&Name]() {return Name == V->info.name;})
But it says that V
an enclosing-function local variable cannot be referenced in a lambda body unless it is in the capture list.
c++ lambda
c++ lambda
New contributor
New contributor
edited yesterday
jvb
1133
1133
New contributor
asked yesterday
black sheepblack sheep
603
603
New contributor
New contributor
1
Noreturn
if nothing found?
– Deduplicator
yesterday
add a comment |
1
Noreturn
if nothing found?
– Deduplicator
yesterday
1
1
No
return
if nothing found?– Deduplicator
yesterday
No
return
if nothing found?– Deduplicator
yesterday
add a comment |
5 Answers
5
active
oldest
votes
find_if
is going to pass the elements of the vector into your lambda. That means you need
std::find_if(V.begin(), V.end(), [&Name](auto const& V) {return Name == V->info.name;})
so that the V
in the lambda body is the element of the vector, not the vector itself.
Ideally you'd give it a different name than V
so you keep the vector and local variables separate like
std::find_if(V.begin(), V.end(), [&Name](auto const& element) {return Name == elememt->info.name;})
So now it is clear you are working on a element of the vector, instead of the vector itself.
4
It would be better not to use the same nameV
for two different things (the vector and the iterator). Thus,std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.
– Handy999
yesterday
@Handy999it
is also misleading though, since it's not an iterator. Maybevalue
,element
or whatever else :)
– Rakete1111
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it asV
as it makes my last sentence very succinct.
– NathanOliver
yesterday
add a comment |
First, V->info.name
is ill formed, inside or outside of the lambda.
The function object sent to the algoritm std::find_if
must be a unary function. It must take the current element to check as a parameter.
auto found = std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const& item_to_check) {
return Name == item_to_check->info.name;
}
);
The type of found
is an iterator to the element that has been found. If none is found, then it returns V.end()
If you use C++14 or better, you can even use generic lambdas:
auto found = std::find_if(
V.begin(), V.end(),
[&Name](auto const& item_to_check) {
return Name == item_to_check->info.name;
}
);
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload->
.
– Silvio Mayolo
yesterday
2
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use->
on object of types that don't overloadoperator->
– Guillaume Racicot
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
1
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
add a comment |
std::find_if
's predicate will receive a reference to each element of the range in turn. You need:
std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const &v) { return Name == v->info.name; }
);
add a comment |
Get V
as parameter to the lambda.
std::find_if(V.begin(), V.end(), [&Name](type& V) {return Name == V->info.name;)
add a comment |
Use const auto &
to access the individual elements from your vector in the lambda expression. Since the vector is an lvalue, auto will be deduced to const vector<PVertex> &
. Then, you can use std::distance
to find the element location of the object in the vector.
struct PVertex
{
std::string name;
};
int main()
{
std::vector<PVertex> V = {{"foo"},{"bar"},{"cat"},{"dog"}};
std::string Name = "cat";
auto found = std::find_if(std::begin(V), std::end(V), [&Name](const auto &v){return (Name == v.name);});
std::cout<< "found at: V["<<std::distance(std::begin(V),found)<<"]" <<std::endl;
}
Result is:
found at: V[2]
Example: https://rextester.com/IYNA58046
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
black sheep is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55243276%2fc-lambda-syntax%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
find_if
is going to pass the elements of the vector into your lambda. That means you need
std::find_if(V.begin(), V.end(), [&Name](auto const& V) {return Name == V->info.name;})
so that the V
in the lambda body is the element of the vector, not the vector itself.
Ideally you'd give it a different name than V
so you keep the vector and local variables separate like
std::find_if(V.begin(), V.end(), [&Name](auto const& element) {return Name == elememt->info.name;})
So now it is clear you are working on a element of the vector, instead of the vector itself.
4
It would be better not to use the same nameV
for two different things (the vector and the iterator). Thus,std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.
– Handy999
yesterday
@Handy999it
is also misleading though, since it's not an iterator. Maybevalue
,element
or whatever else :)
– Rakete1111
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it asV
as it makes my last sentence very succinct.
– NathanOliver
yesterday
add a comment |
find_if
is going to pass the elements of the vector into your lambda. That means you need
std::find_if(V.begin(), V.end(), [&Name](auto const& V) {return Name == V->info.name;})
so that the V
in the lambda body is the element of the vector, not the vector itself.
Ideally you'd give it a different name than V
so you keep the vector and local variables separate like
std::find_if(V.begin(), V.end(), [&Name](auto const& element) {return Name == elememt->info.name;})
So now it is clear you are working on a element of the vector, instead of the vector itself.
4
It would be better not to use the same nameV
for two different things (the vector and the iterator). Thus,std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.
– Handy999
yesterday
@Handy999it
is also misleading though, since it's not an iterator. Maybevalue
,element
or whatever else :)
– Rakete1111
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it asV
as it makes my last sentence very succinct.
– NathanOliver
yesterday
add a comment |
find_if
is going to pass the elements of the vector into your lambda. That means you need
std::find_if(V.begin(), V.end(), [&Name](auto const& V) {return Name == V->info.name;})
so that the V
in the lambda body is the element of the vector, not the vector itself.
Ideally you'd give it a different name than V
so you keep the vector and local variables separate like
std::find_if(V.begin(), V.end(), [&Name](auto const& element) {return Name == elememt->info.name;})
So now it is clear you are working on a element of the vector, instead of the vector itself.
find_if
is going to pass the elements of the vector into your lambda. That means you need
std::find_if(V.begin(), V.end(), [&Name](auto const& V) {return Name == V->info.name;})
so that the V
in the lambda body is the element of the vector, not the vector itself.
Ideally you'd give it a different name than V
so you keep the vector and local variables separate like
std::find_if(V.begin(), V.end(), [&Name](auto const& element) {return Name == elememt->info.name;})
So now it is clear you are working on a element of the vector, instead of the vector itself.
edited yesterday
answered yesterday
NathanOliverNathanOliver
95.8k16135208
95.8k16135208
4
It would be better not to use the same nameV
for two different things (the vector and the iterator). Thus,std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.
– Handy999
yesterday
@Handy999it
is also misleading though, since it's not an iterator. Maybevalue
,element
or whatever else :)
– Rakete1111
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it asV
as it makes my last sentence very succinct.
– NathanOliver
yesterday
add a comment |
4
It would be better not to use the same nameV
for two different things (the vector and the iterator). Thus,std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.
– Handy999
yesterday
@Handy999it
is also misleading though, since it's not an iterator. Maybevalue
,element
or whatever else :)
– Rakete1111
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it asV
as it makes my last sentence very succinct.
– NathanOliver
yesterday
4
4
It would be better not to use the same name
V
for two different things (the vector and the iterator). Thus, std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.– Handy999
yesterday
It would be better not to use the same name
V
for two different things (the vector and the iterator). Thus, std::find_if(V.begin(), V.end(), [&Name](auto const& it) {return Name == it->info.name;})
would be better.– Handy999
yesterday
@Handy999
it
is also misleading though, since it's not an iterator. Maybe value
, element
or whatever else :)– Rakete1111
yesterday
@Handy999
it
is also misleading though, since it's not an iterator. Maybe value
, element
or whatever else :)– Rakete1111
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it as
V
as it makes my last sentence very succinct.– NathanOliver
yesterday
@Handy999 You're right about giving it a better name, I just wanted to keep it as
V
as it makes my last sentence very succinct.– NathanOliver
yesterday
add a comment |
First, V->info.name
is ill formed, inside or outside of the lambda.
The function object sent to the algoritm std::find_if
must be a unary function. It must take the current element to check as a parameter.
auto found = std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const& item_to_check) {
return Name == item_to_check->info.name;
}
);
The type of found
is an iterator to the element that has been found. If none is found, then it returns V.end()
If you use C++14 or better, you can even use generic lambdas:
auto found = std::find_if(
V.begin(), V.end(),
[&Name](auto const& item_to_check) {
return Name == item_to_check->info.name;
}
);
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload->
.
– Silvio Mayolo
yesterday
2
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use->
on object of types that don't overloadoperator->
– Guillaume Racicot
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
1
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
add a comment |
First, V->info.name
is ill formed, inside or outside of the lambda.
The function object sent to the algoritm std::find_if
must be a unary function. It must take the current element to check as a parameter.
auto found = std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const& item_to_check) {
return Name == item_to_check->info.name;
}
);
The type of found
is an iterator to the element that has been found. If none is found, then it returns V.end()
If you use C++14 or better, you can even use generic lambdas:
auto found = std::find_if(
V.begin(), V.end(),
[&Name](auto const& item_to_check) {
return Name == item_to_check->info.name;
}
);
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload->
.
– Silvio Mayolo
yesterday
2
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use->
on object of types that don't overloadoperator->
– Guillaume Racicot
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
1
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
add a comment |
First, V->info.name
is ill formed, inside or outside of the lambda.
The function object sent to the algoritm std::find_if
must be a unary function. It must take the current element to check as a parameter.
auto found = std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const& item_to_check) {
return Name == item_to_check->info.name;
}
);
The type of found
is an iterator to the element that has been found. If none is found, then it returns V.end()
If you use C++14 or better, you can even use generic lambdas:
auto found = std::find_if(
V.begin(), V.end(),
[&Name](auto const& item_to_check) {
return Name == item_to_check->info.name;
}
);
First, V->info.name
is ill formed, inside or outside of the lambda.
The function object sent to the algoritm std::find_if
must be a unary function. It must take the current element to check as a parameter.
auto found = std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const& item_to_check) {
return Name == item_to_check->info.name;
}
);
The type of found
is an iterator to the element that has been found. If none is found, then it returns V.end()
If you use C++14 or better, you can even use generic lambdas:
auto found = std::find_if(
V.begin(), V.end(),
[&Name](auto const& item_to_check) {
return Name == item_to_check->info.name;
}
);
edited yesterday
answered yesterday
Guillaume RacicotGuillaume Racicot
15.4k53568
15.4k53568
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload->
.
– Silvio Mayolo
yesterday
2
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use->
on object of types that don't overloadoperator->
– Guillaume Racicot
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
1
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
add a comment |
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload->
.
– Silvio Mayolo
yesterday
2
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use->
on object of types that don't overloadoperator->
– Guillaume Racicot
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
1
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload ->
.– Silvio Mayolo
yesterday
V->info.name
is valid syntax. It just won't typecheck since vectors don't overload ->
.– Silvio Mayolo
yesterday
2
2
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use ->
on object of types that don't overload operator->
– Guillaume Racicot
yesterday
It just won't typecheck since vectors don't overload ->
so... it won't compile? It's an invalid syntax to use ->
on object of types that don't overload operator->
– Guillaume Racicot
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
Not all compile errors are syntax errors. See syntax vs. semantics.
– Silvio Mayolo
yesterday
1
1
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
@SilvioMayolo The answer you linked me says that semantics is the meaning of the program, usually in it's runtime behaviour. The code I quoted is simply ill formed, there is no semantic yet. Or maybe I don't understand the concept correctly
– Guillaume Racicot
yesterday
add a comment |
std::find_if
's predicate will receive a reference to each element of the range in turn. You need:
std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const &v) { return Name == v->info.name; }
);
add a comment |
std::find_if
's predicate will receive a reference to each element of the range in turn. You need:
std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const &v) { return Name == v->info.name; }
);
add a comment |
std::find_if
's predicate will receive a reference to each element of the range in turn. You need:
std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const &v) { return Name == v->info.name; }
);
std::find_if
's predicate will receive a reference to each element of the range in turn. You need:
std::find_if(
V.begin(), V.end(),
[&Name](koalaGraph::PVertex const &v) { return Name == v->info.name; }
);
answered yesterday
QuentinQuentin
46.6k589146
46.6k589146
add a comment |
add a comment |
Get V
as parameter to the lambda.
std::find_if(V.begin(), V.end(), [&Name](type& V) {return Name == V->info.name;)
add a comment |
Get V
as parameter to the lambda.
std::find_if(V.begin(), V.end(), [&Name](type& V) {return Name == V->info.name;)
add a comment |
Get V
as parameter to the lambda.
std::find_if(V.begin(), V.end(), [&Name](type& V) {return Name == V->info.name;)
Get V
as parameter to the lambda.
std::find_if(V.begin(), V.end(), [&Name](type& V) {return Name == V->info.name;)
answered yesterday
Petar VelevPetar Velev
1,681619
1,681619
add a comment |
add a comment |
Use const auto &
to access the individual elements from your vector in the lambda expression. Since the vector is an lvalue, auto will be deduced to const vector<PVertex> &
. Then, you can use std::distance
to find the element location of the object in the vector.
struct PVertex
{
std::string name;
};
int main()
{
std::vector<PVertex> V = {{"foo"},{"bar"},{"cat"},{"dog"}};
std::string Name = "cat";
auto found = std::find_if(std::begin(V), std::end(V), [&Name](const auto &v){return (Name == v.name);});
std::cout<< "found at: V["<<std::distance(std::begin(V),found)<<"]" <<std::endl;
}
Result is:
found at: V[2]
Example: https://rextester.com/IYNA58046
add a comment |
Use const auto &
to access the individual elements from your vector in the lambda expression. Since the vector is an lvalue, auto will be deduced to const vector<PVertex> &
. Then, you can use std::distance
to find the element location of the object in the vector.
struct PVertex
{
std::string name;
};
int main()
{
std::vector<PVertex> V = {{"foo"},{"bar"},{"cat"},{"dog"}};
std::string Name = "cat";
auto found = std::find_if(std::begin(V), std::end(V), [&Name](const auto &v){return (Name == v.name);});
std::cout<< "found at: V["<<std::distance(std::begin(V),found)<<"]" <<std::endl;
}
Result is:
found at: V[2]
Example: https://rextester.com/IYNA58046
add a comment |
Use const auto &
to access the individual elements from your vector in the lambda expression. Since the vector is an lvalue, auto will be deduced to const vector<PVertex> &
. Then, you can use std::distance
to find the element location of the object in the vector.
struct PVertex
{
std::string name;
};
int main()
{
std::vector<PVertex> V = {{"foo"},{"bar"},{"cat"},{"dog"}};
std::string Name = "cat";
auto found = std::find_if(std::begin(V), std::end(V), [&Name](const auto &v){return (Name == v.name);});
std::cout<< "found at: V["<<std::distance(std::begin(V),found)<<"]" <<std::endl;
}
Result is:
found at: V[2]
Example: https://rextester.com/IYNA58046
Use const auto &
to access the individual elements from your vector in the lambda expression. Since the vector is an lvalue, auto will be deduced to const vector<PVertex> &
. Then, you can use std::distance
to find the element location of the object in the vector.
struct PVertex
{
std::string name;
};
int main()
{
std::vector<PVertex> V = {{"foo"},{"bar"},{"cat"},{"dog"}};
std::string Name = "cat";
auto found = std::find_if(std::begin(V), std::end(V), [&Name](const auto &v){return (Name == v.name);});
std::cout<< "found at: V["<<std::distance(std::begin(V),found)<<"]" <<std::endl;
}
Result is:
found at: V[2]
Example: https://rextester.com/IYNA58046
answered yesterday
Constantinos GlynosConstantinos Glynos
1,581820
1,581820
add a comment |
add a comment |
black sheep is a new contributor. Be nice, and check out our Code of Conduct.
black sheep is a new contributor. Be nice, and check out our Code of Conduct.
black sheep is a new contributor. Be nice, and check out our Code of Conduct.
black sheep is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55243276%2fc-lambda-syntax%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
No
return
if nothing found?– Deduplicator
yesterday