Before compile VS says that
Error member "test::A" is not a variable
Error member "test::B" is not a variable
Code:
#include <iostream>
#include <ppl.h>
using namespace concurrency;
using namespace std;
class test
{
static double A[ 3 ][ 3 ];
static double B[ 3 ][ 3 ];
public:
int test_function();
};
double test::A[ 3 ][ 3 ] = { { 0.7, -0.2, -1 },
{ -4, -2, -2 },
{ -0.4, 1.7, -1.8 } };
double test::B[ 3 ][ 3 ] = { { 0.6, -1.2, 1.1 },
{ 2, 3, -2 },
{ -1, 0.05, 0.05} };
int test::test_function()
{
parallel_for ( 0, 100, [ &A, &B ]( int y ) {
for ( int x = 0; x < 100; x++ ) {
for ( int i = 0; i < 3; i++ )
for ( int j = 0; j < 3; j++ )
A[ j ][ i ] += A[ j ][ i ] * B[ j ][ i ];
}
} );
}
int main()
{
return 0;
}
Error:
'test::A': a lambda capture variable must be from an enclosing function scope
'test::B': a lambda capture variable must be from an enclosing function scope
what should I do?