943,962 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 7791
  • C RSS
Jan 29th, 2006
0

non-lvalue in assignment

Expand Post »
I have a matrix class which there are matrix objects. I want to call .value(int,int) directly on the matrix objects and set the internal 2d vector to the value on the right side of the equal sign.

Here is what I want to do:

[code]
new_matrix.value(row,col) = 0;
[code]

Here is what I've tried:

  1. int &Matrix::value(int row, int col)
  2. {
  3. return this->mat[row][col];
  4. }

Where mat is the internal 2d vector data.
Similar Threads
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jan 29th, 2006
0

Re: non-lvalue in assignment

I don't find any problem in the code
SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005
Jan 30th, 2006
0

Re: non-lvalue in assignment

That's what someone else said. Which compiler are you using? I'm using bloodshed.
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jan 30th, 2006
0

Re: non-lvalue in assignment

It should work in both dev and VC...anyworks from next time give your complete code
SpS
Reputation Points: 70
Solved Threads: 32
Posting Pro
SpS is offline Offline
598 posts
since Aug 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: modular programming
Next Thread in C Forum Timeline: How to concatenate two values in an char array





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC