constexpr int SomeValue = 0; struct SomeClass { explicit SomeClass (int) { } void operator () (int = 0) { } }; enum SomeEnum { ValueA, ValueB, ValueC, ValueD }; void example1 () { auto closure = [] (int) { return [] () { }; }; closure(SomeValue)(); } void example2 () { SomeClass(SomeValue)(); } void example3 (SomeEnum x) { switch (x) { case ValueA: case ValueB: case ValueC: case ValueD: ; } SomeClass(ValueB)(ValueD); } void bonus () { auto closure = [] (int) { return [] () { }; }; closure(SomeValue)(); SomeClass(SomeValue)(); } /* * static const auto setupChart = [&] (When when) { return [&, when] () { switch (when) { case BeforeAddSeries: case BeforeAddAxes: case BeforeSetView: case BeforeShowView: case AfterEverything: } }; }; (void)setupChart; // setupChart(BeforeSetView)(); */