I am trying to create an array of functors at compile time, for example: (full file):
#include <functional>
using namespace std;
function< float( float tElevation, float pAzimuth )> colorFunctions[] = {
[]( float tElevation, float pAzimuth ) -> float {
return 2.0f ;
},
} ;
int main()
{
}
It works great. But as soon as you try to create a local one inside the functor block, for example:
function< float( float tElevation, float pAzimuth )> colorFunctions[] = {
[]( float tElevation, float pAzimuth ) -> float {
float v = 2.0f ;
return v ;
},
} ;
You get the error Error 1 C1506: error repairing an unrecoverable block
How can I declare local residents inside these blocks? This does not seem to work.
source
share