S
Stephen J. Fromm
I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
TIA,
sjfromm
stack<string[3]> parentStack;
TIA,
sjfromm
Stephen J. Fromm said:I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
TIA,
sjfromm
John said:I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
TIA,
sjfromm
You can have containers of arrays,
but the declaration youv'e posted
above is faulty. Youv'e declared a stack where each element is 3
strings. This is fine in principle,
but probaly what you should do is
declare a struct that defines the stack elements, then declare the
stack as a stack of those things, like this:
struct STRINGS
{
string m_Strings[3];
}; // STRINGS
int main()
{
std::stack<STRINGS> stk;
return 0;
}
Victor Bazarov said:Stephen J. Fromm said:I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
Yes.
John Dibling said:On 29 Jul 2003 10:18:57 -0700, (e-mail address removed) (Stephen J.
Fromm) wrote:
I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
TIA,
sjfromm
You can have containers of arrays, but the declaration youv'e posted
above is faulty. Youv'e declared a stack where each element is 3
strings. This is fine in principle, but probaly what you should do is
declare a struct that defines the stack elements, then declare the
stack as a stack of those things, like this:
struct STRINGS
{
string m_Strings[3];
}; // STRINGS
int main()
{
std::stack<STRINGS> stk;
return 0;
}
</dib>
John Dibling
Witty banter omitted for your protection
Stephen J. Fromm said:"Victor Bazarov" <[email protected]> wrote in messageStephen J. Fromm said:I take it I cannot form a container of an array type? For example,
stack<string[3]> parentStack;
Yes.
Victor,
Yes, I can form, or yes, I cannot form?
Stephen said:What I'm curious about is whether I can *directly* define a stack<...>
of an array or not.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.