sophus value required as left operand of assignment

i get this error 'lvalue required as left operand of assignment' when a run a same piece of code in QT on a windows machine but works fine when i use a linux machine.

unsigned int width = Width, height = Height, slice = Slice;

typedef boost::multi_array<std::complex<double>,3> IMAGE;
typedef IMAGE::index im;
IMAGE Image(boost::extents[slice][height][width]);

for (im i = 0; i < slice; i++)
{
    for (im j = 0; j < height; j++)
    {
        for (im k = 0; k < width; k++)
        {
            Image[i][j][k].real() = image[i][j][k];
            Image[i][j][k].imag() = 0;
        }
    }
}
is the error because of a difference in compiler? or is there something i am missing? the linux version has a GCC compiler and the windows version uses MINGW 32 bit

c++ qt




real() and imag() returning assignable references was a non-standard extension for libstdc++ (source). If you set -std=c++1y in g++, you'll get the same error.

For changing the values you should be using the 'setter' version instead:

Image[i][j][k].real(image[i][j][k]);
Image[i][j][k].imag(0);

我来吐槽

*

*