I am used to defining a struct as follows:
1 2 3 4 5
|
struct Point
{
int x;
int y;
};
| |
with data members 'x' and 'y' where this is initialized as follows:
struct Point p1 = {0, 1};
I know these are different definitions,
But, it seems that a struct may also be defined as:
1 2 3 4 5 6
|
struct A
{
A(int) { } // converting constructor
A(int, int) { } // converting constructor (C++11)
operator bool() const { return true; }
};
| |
where the latter struct is used as follows:
A a1 = 1; // copy-initialization selects A::A(int)
But, some interesting questions arise:
Where is the data member in 'struct A' ?
Is it implicitly determined (and defined) ?
If so, is this only because there is only one value stored in 'struct A' ?
Is this leaving out the data member a change due to recent C++ standards ?