Accessing elements

Hey, I have successfully created an array called 'diskArray' of deques that stores objects called 'PCB'. I am having trouble understanding how to accesses a public int called 'cylinder' that is stored in my 'PCB'. In my mind the code should look something like this

diskArray[num].end().pcb.cylinder

Any help would be greatly appreciated
.end() on standard library containers returns an iterator to the element past-the-end of the container, which doesn't exist. Maybe you wanted .back() instead, which actually returns a reference to the last element.

Also, you don't need to mention the name of the class anywhere in the expression.

Though I do want to know, why do you need a C-style array of std::deque?
Last edited on
Thank you this worked

The assignment is to simulate an OS, and so I need to store PCB's in certain disk. I need to keep track of which disk which PCB's are stored in. So there can be 20 disks(the array positions) filled with PCB's (objects stored in the deque's)

And now I have to implement c-look on these stored PCB's and re-organize them (if you have any suggestions or sources for that, that would be awesome)
Why not use std::vector instead of a C-style array? I also am not sure why you need to use a double-ended queue here.
Topic archived. No new replies allowed.