Click to See Complete Forum and Search --> : help about queue


deepinlife
July 13th, 2005, 02:20 PM
why this give error:
{
queue<char[4]> list;
char temp[4];
list.push( temp );
temp = list.front();
}

AvDav
July 13th, 2005, 02:27 PM
because the type of temp is constant pointer.

deepinlife
July 13th, 2005, 03:30 PM
even if we take the line
{
temp - list.front();
}there is still error..
the error is in pushing line
{
list.push( temp );
}

Andreas Masur
July 13th, 2005, 03:35 PM
Well...simply because you cannot use arrays with the STL containers...simply use 'string' instead...

#include <queue>
#include <string>

std::queue<std::string> list;
std::string s("Hello");
list.push(s);
std::string t = list.front();