Re: complex. (was: jfet plugin)

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
On Tue, Jul 08, 2014 at 01:15:52PM -0500, wikitronic wrote:
> I hope you don't mind me adding a second question. I'm cross compiling to
> javasacript with emscripten. I was hoping to link the module into the main
> program because emscripten is picky about dynamic linking. I have this one
> line of code that is really confusing me.
> 
> In spice-wrapper.cc 1235.
> 
> _matrix[ii][jj].real() = 0;
> error: expression is not assignable
> 
> could you please tell me what this does and maybe I can fix the compiler
> error.

_matrix[ii][jj] is (should be) an std::complex<double>.

i thought std::complex<T> has a T& real(). apparently my implementation
has one, and it's been used and working forever. but e.g. [1,2] do not
list it, so you might have discovered a bug :)

anyway, if .real() = rvalue does not work for you, try .real(rvalue).

cheers
felix

[1] http://en.cppreference.com/w/cpp/numeric/complex/real
[2] http://stdcxx.apache.org/doc/stdlibref/complex-h.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.