Re: Taking values from Queue
Donos wrote:
> I am working on a design in which there is a Queue which will read
> data from a database. This happens in one particular class.
>
> Class CRecieveData
> {
> std::queue<unsigned char> m_RxQueue;
> }
>
> Here the data is added into Queue using "push" function.
>
> Now as per the design i have to extract the data from Queue in another
> Class using Deque.
>
> class CDecodeData
> {
> // Need to add code here to extract data from Queue declared
> in another class, using Deque Iterator
> }
>
> ie, by using an Iterator of Deque.
>
> Can anyone tell me how to do this?
Nobody can tell you. There is no way to extract an object from
a std::queue using an object of an unrelated type (iterator to some
std::deque). Even though 'std::queue' can be implemented using
'std::deque' as its underlying container, there is no standard way
to go from an iterator to a 'deque' to the 'queue' the 'deque' is
used to implement. Make sure the reference to the actual 'queue'
is passed to your scope.
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
|