I have a trouble with printing data from priority queue. This data is structure. How can I print structures from my queue?
Here is my structure:
struct pinfo
{
int p_id;
char path[50];
int type;
int priority;
};
Here I tried to print my data:
void showpq(priority_queue <pinfo> pQueue)
{
priority_queue <pinfo> g = pQueue;
while (!g.empty())
{
cout << "\t" << g.top();
g.pop();
}
cout << '\n';
}
When I tried to print data I get the error message:
main.cpp:23: error: no match for ‘operator<<’ (operand types are ‘std::basic_ostream<char>’ and ‘const value_type {aka const pinfo}’)
cout << "\t" << g.top();