A
Ami
Hi All,
I am facing a very basic problem of returning a value from template based stack class where It is possible that stack has no values to pop but as per declaration it must return <type> value.
template <class T> T stack<T>:op()
{
T val;
if (empty())
{
return val;
}
return nodes[top--];
}
Any help is highly appreciated.
Thanks.
I am facing a very basic problem of returning a value from template based stack class where It is possible that stack has no values to pop but as per declaration it must return <type> value.
template <class T> T stack<T>:op()
{
T val;
if (empty())
{
return val;
}
return nodes[top--];
}
Any help is highly appreciated.
Thanks.