I'm trying to create an array of functors at compile time, like so: (complete file):
#include <functional>
using namespace std;
function< float( float tElevation, float pAzimuth )> colorFunctions[] = {
  []( float tElevation, float pAzimuth ) -> float {
    return 2.0f ;
  },
} ;
int main()
{
}
That works fine. But as soon as you try to create a local inside the functor block, like this:
function< float( float tElevation, float pAzimuth )> colorFunctions[] = {
  []( float tElevation, float pAzimuth ) -> float {
    float v = 2.0f ;
    return v ;
  },
} ;
You get Error 1 error C1506: unrecoverable block scoping error
How can I declare locals inside these blocks? It doesn't seem to work.
 
     
     
    