What do these statement does? i can't understand the right-hand of =(equal to) does. can anyone help me with it??

lang : c++ Statement : auto Submask=[&](int A,int B{return((A&B)==A);};

Thanks in advance !!

Reminder: in case of any technical issues, you can use the lightweight website
m1.codeforces.com,
m2.codeforces.com,
m3.codeforces.com.
×

Contest is running

Codeforces Round #606 (Div. 1, based on Technocup 2020 Elimination Round 4)

01:14:10

Codeforces Round #606 (Div. 1, based on Technocup 2020 Elimination Round 4)

01:14:10

Contest is running

Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4)

01:14:10

Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4)

01:14:10

# | User | Rating |
---|---|---|

1 | tourist | 3556 |

2 | wxhtxdy | 3520 |

3 | Radewoosh | 3409 |

4 | Benq | 3368 |

5 | mnbvmar | 3280 |

6 | ecnerwala | 3278 |

7 | LHiC | 3276 |

8 | sunset | 3264 |

9 | maroonrk | 3159 |

10 | TLE | 3145 |

# | User | Contrib. |
---|---|---|

1 | Errichto | 189 |

2 | Radewoosh | 177 |

3 | tourist | 173 |

4 | antontrygubO_o | 172 |

5 | Vovuh | 168 |

6 | PikMike | 166 |

7 | rng_58 | 157 |

7 | majk | 157 |

9 | farmersrice | 153 |

9 | Um_nik | 153 |

What do these statement does? i can't understand the right-hand of =(equal to) does. can anyone help me with it??

lang : c++ Statement : auto Submask=[&](int A,int B{return((A&B)==A);};

Thanks in advance !!

↑

↓

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Dec/14/2019 14:50:51 (g2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|

It's lambda expression. You can read about it here.

Ok so they can be passed as a parameter to functions in c++ for example sort function. Like the codes below.

if you feel uncomfortable with these type of expressions you can also do the same thing in another way

It is up to you what feels easy to use. Cheers :)

but here we are given a '&' in bracket [] what is the use of it and what is the use of that bracket and Submask is function, functor or variable ?

These are called lambda captures if you are interested more here. Cheers :)