It isn't possible to assign a vector to a stucture is it?

This is a discussion on It isn't possible to assign a vector to a stucture is it? within the C++ Programming forums, part of the General Programming Boards category; is this possible? Skins is a vector of type Skin*. pSkin is an instance of Skin*. Code: Skins[VectorIndices] = pSkin; ...

  1. #1
    Shadow12345
    Guest

    It isn't possible to assign a vector to a stucture is it?

    is this possible? Skins is a vector of type Skin*. pSkin is an instance of Skin*.

    Code:
    Skins[VectorIndices]		=	pSkin;
    EDIT:
    what does this error mean?
    left operand must be l-value
    Last edited by Shadow12345; 11-29-2002 at 11:18 PM.

  2. #2
    Veni Vidi Vice
    Join Date
    Aug 2001
    Posts
    343
    what does this error mean?
    left operand must be l-value
    l-value means location value. By that I mean that an adress in memory where a value is stored e.i. a variable. The opposite is r-value, read-value that mean what a value can only be read e.i. literal constant.

    P.S. A variable can serve as a l-value and a r-value depending how itīs used.

    Code:
    int number;
    ...
    ...
    ...
    //Number serves here as a lvalue
    number = 50;
    Code:
    int number=100;
    int copy;
    ...
    ...
    ...
    //Number serves here as a rvalue
    copy = number;
    And yourīs code snippet should work.

  3. #3
    Shadow12345
    Guest
    My vectors are made up of structures, when I call
    vector.pushback(new struct) does that effectively 'work'? I mean structures don't have constructors in the sense that classes do.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Assign null to a character array.
    By mahedee in forum C Programming
    Replies: 1
    Last Post: 08-06-2008, 08:16 AM
  2. Generate Random Numbers and Assign to Days of Week
    By mms in forum C++ Programming
    Replies: 10
    Last Post: 05-04-2006, 02:51 AM
  3. Random Question Assign Program
    By mikeprogram in forum C++ Programming
    Replies: 6
    Last Post: 11-17-2005, 10:04 PM
  4. Linked list question....again
    By dP munky in forum C++ Programming
    Replies: 3
    Last Post: 04-03-2003, 05:59 PM
  5. HelpMePlease
    By Prncess100 in forum C++ Programming
    Replies: 6
    Last Post: 12-11-2002, 02:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21