Created
          September 14, 2014 07:21 
        
      - 
      
- 
        Save wallstop/d36133b6c3ef429795d7 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | void doTheThing(const SomeEnum& enum) | |
| { | |
| const int bindedVariable = | |
| [&]() | |
| { | |
| switch(enum) | |
| { | |
| case SOME_ENUM_VAL_1: | |
| return 200; | |
| case SOME_ENUM_VAL_2; | |
| return 400; | |
| default: | |
| return 600; | |
| } | |
| }(); | |
| // Do other stuff | |
| } | |
| void doTheThingTwo(bool testCondition) | |
| { | |
| const MemoryIntensiveObject myIntensiveInstance = | |
| [&]() | |
| { | |
| if(testCondition) | |
| return std::move(MemoryIntensiveObject(paramSet1)); | |
| else | |
| return std::move(MemoryIntensiveObject(paramSet2)); | |
| }(); | |
| // Do other stuff; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment