File: lambda.cpp

package info (click to toggle)
yrmcds 1.1.9-1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 940 kB
  • sloc: cpp: 11,149; sh: 148; makefile: 117
file content (8 lines) | stat: -rw-r--r-- 185 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
#include <cybozu/test.hpp>

AUTOTEST(lambda) {
    int x = 3;
    auto foo = [=]() mutable { ++x; return x * x; };
    cybozu_assert( foo() == 16 );
    cybozu_assert( foo() == 25 );
}