Original Post
Hello,
i have a problem i dont understand.
I have a class Test with a struct teststr and use union for the struct.
[source lang="cpp"]#include
class Test
{
struct teststr
{
bool test;
};
union
{
teststr size;
};
};[/source]
In the main i want too push the Test object in the queue.
[source lang="cpp"]std::queue m_tests; ///< Queue of available tests
Test test1; //test1.teststr.test is null/empty????
Test test2; //test2.teststr.test is null//empty ??[/source]
The problem is that the test1 var ist initialized but not the struct within ????
So here test1.teststr.test is empty.
If i set Test test1; before the queue the struct is initialized so test1.teststr.test is filled.
[source lang="cpp"]Test test1; //.teststr.test is filled !!
std::queue m_tests; ///< Queue of available tests
Test test2; //test2.teststr.test is filled !![/source]
So my question is:
why is the struct teststr not initialized/set if use the following order?
[source lang="cpp"]std::queue m_tests; ///< Queue of available tests
Test test1; //test1.teststr.test is null/empty????
Test test2; //test2.teststr.test is null//empty ??;[/source]
i have a problem i dont understand.
I have a class Test with a struct teststr and use union for the struct.
[source lang="cpp"]#include
class Test
{
struct teststr
{
bool test;
};
union
{
teststr size;
};
};[/source]
In the main i want too push the Test object in the queue.
[source lang="cpp"]std::queue
Test test1; //test1.teststr.test is null/empty????
Test test2; //test2.teststr.test is null//empty ??[/source]
The problem is that the test1 var ist initialized but not the struct within ????
So here test1.teststr.test is empty.
If i set Test test1; before the queue the struct is initialized so test1.teststr.test is filled.
[source lang="cpp"]Test test1; //.teststr.test is filled !!
std::queue
Test test2; //test2.teststr.test is filled !![/source]
So my question is:
why is the struct teststr not initialized/set if use the following order?
[source lang="cpp"]std::queue
Test test1; //test1.teststr.test is null/empty????
Test test2; //test2.teststr.test is null//empty ??;[/source]