non-lvalue in assignment

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

non-lvalue in assignment

 
0
  #1
Jan 29th, 2006
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.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: non-lvalue in assignment

 
0
  #2
Jan 29th, 2006
I don't find any problem in the code
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: non-lvalue in assignment

 
0
  #3
Jan 30th, 2006
That's what someone else said. Which compiler are you using? I'm using bloodshed.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 598
Reputation: SpS is on a distinguished road 
Solved Threads: 32
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: non-lvalue in assignment

 
0
  #4
Jan 30th, 2006
It should work in both dev and VC...anyworks from next time give your complete code
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC