0

I have this code.

boost::for_each(
    boost::make_iterator_range(
            func(arg1),
            func(arg2)
        ),
        [&d, &f](const a<b>& c)
        {
            something;
        }
);

I understand the iterator part of the code. What is not clear to me is over what we iterate. What does this construction mean? [](){}

Roman
  • 97,757
  • 149
  • 317
  • 426
  • 1
    [This question](http://stackoverflow.com/questions/7627098/what-is-a-lambda-expression-in-c11) has a pretty good explanation. – chris Mar 13 '13 at 15:31

1 Answers1

1

This is a lambda-expression , an anonymous method/function. You can provide it inline if there is no reason to define a distinct function. [] binds the local parameters either by value [] or by reference [&]. In () you pass your values like in a function call and {} embraces the function body.

See here.

0x499602D2
  • 87,005
  • 36
  • 149
  • 233
bash.d
  • 12,357
  • 2
  • 24
  • 37