?
=?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?=
Hello.
My understanding is that the struct /ItemExtrato/ in the following test
program is an aggregate type. As such, one should be able to use a
brace-enclosed initializer list. This is true, despite the fact that the
struct is not a POD type. Could anyone confirm that I am not mistaken?
#include <string>
struct ItemExtrato
{
std::string data;
std::string historico;
std::string documento;
double valor;
int pontos;
int saldo;
};
int main()
{
ItemExtrato item =
{
"17/12/2005",
"Um teste",
"DOC001",
150.0,
10,
32
};
}
The reason I ask is because the above program compiles successfully with
one compiler [1] and fails with another [2]. I tend to believe the older
compiler is at fault.
[1] MS 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
[2] Borland C++ 5.6 for Win32
Thank you for your input,
My understanding is that the struct /ItemExtrato/ in the following test
program is an aggregate type. As such, one should be able to use a
brace-enclosed initializer list. This is true, despite the fact that the
struct is not a POD type. Could anyone confirm that I am not mistaken?
#include <string>
struct ItemExtrato
{
std::string data;
std::string historico;
std::string documento;
double valor;
int pontos;
int saldo;
};
int main()
{
ItemExtrato item =
{
"17/12/2005",
"Um teste",
"DOC001",
150.0,
10,
32
};
}
The reason I ask is because the above program compiles successfully with
one compiler [1] and fails with another [2]. I tend to believe the older
compiler is at fault.
[1] MS 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
[2] Borland C++ 5.6 for Win32
Thank you for your input,