Here you can learn about how to use the aff::Array class.
This test program gives an example of the usage of the following classes, functions, and preprocessor macros:
- See also
- tests/arraytest.cc
#define AFF_ARRAYTEST_CC_VERSION \
"AFF_ARRAYTEST_CC V1.3"
#define CONT_INDEXCHECK
using std::cout;
using std::endl;
void section(
const char* s,
const char l=
'-')
{
cout << endl << s << endl;
const char* p=s;
while (*p) { cout << l; ++p; }
cout << endl;
}
{
{
}
{
}
{
}
section(
"Test access operators",
'=');
{
for(int i=A.f(0); i<=A.l(0); i++)
{
for(int j=A.f(1); j<=A.l(1); j++)
{
for(int k=A.f(2); k<=A.l(2); k++)
{
for(int l=A.f(3); l<=A.l(3); l++)
{
A(i,j,k,l)=(i-A.f(0)+1)+(j-A.f(1)+1)*10
+(k-A.f(2)+1)*100+(l-A.f(3)+1)*1000;
}
}
}
}
DUMP( A.representation() );
}
{
}
{
CODE( H=A.representation(); );
CODE( H2=B.representation(); );
#ifdef ILLEGAL1
#warning compiling supposedly illegal code
#endif
#ifdef ILLEGAL2
#warning compiling supposedly illegal code
#endif
#ifdef ILLEGAL3
#warning compiling supposedly illegal code
#endif
#ifdef ILLEGAL4
#warning compiling supposedly illegal code
#endif
#ifdef ILLEGAL5
#warning compiling supposedly illegal code
#endif
#ifdef ILLEGAL6
#warning compiling supposedly illegal code
#endif
}
section(
"read access to ConstArray and const Array");
{
CODE( cout << A(2,2) <<
", " << B(2,2) <<
", " << C(2,2) << endl );
#ifdef ILLEGAL7
#warning compiling supposedly illegal code
#endif
}
{
for(int i=A.f(0); i<=A.l(0); i++)
{
for(int j=A.f(1); j<=A.l(1); j++)
{
A(i,j)=(i-A.f(0)+1)+(j-A.f(1)+1)*10;
}
}
}
}