![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2005
Posts: 6
Rep Power: 0
![]() |
hi everybody
i am afraid that i have a problem in using vectors, what i am doing is creating a vector of type struct and add Structs in it there is no compilations errors but it just dont allow adding in it i tried to much but still dont want to add in it so plz anyone can help send me thanks all thats what i did vector<Symbol> SArr(length); //Symbol is a struct SArr.push_back(S1[0]); //S1 is an array of struct |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,260
Rep Power: 5
![]() |
What do you mean wen you say it "won't allow"? Or, to put it another way, how did you determine you have a problem?
As is, your code should not cause any problems unless you've done something strange in code you haven't shown. Your example is also incomplete. Try giving a small but COMPLETE example which illustrates your problem. And wrap your code in code tags, so th code is laid out better. |
|
|
|
|
|
#3 |
|
Professional Programmer
Join Date: May 2005
Location: Bad Nauheim, Germany
Posts: 436
Rep Power: 4
![]() |
A common problem is pointer and dereferencing confusion, which is why I ask: Is S1 possibly an array of pointers to structs? Or, is Symbol possibly defined as a pointer to a struct?
Just a guess. We need more information (code and compiler/runtime errors). Is length != 0? ![]()
__________________
-Steven "Is this a piece of your brain?" - Basil Fawlty |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|