0

I was reading this code on Rosettacode: http://rosettacode.org/wiki/Closest-pair_problem#C.2B.2B

And I stumbled upon this strange function inside of std::copy_if()

std::copy_if(std::begin(yP), std::end(yP), std::back_inserter(yS),
[&minPair, &xM](const point_t& p) {
    return std::abs(xM - p.first) < minPair.first;
});

What does [&minPair, &xM] before function means?

Why function has no name and no return type? Compiler implicitly guesses that its bool?

Thomas Matthews
  • 56,849
  • 17
  • 98
  • 154
ScienceDiscoverer
  • 205
  • 1
  • 3
  • 13

0 Answers0