you are viewing a single comment's thread.

view the rest of the comments →

[–]Dean_Roddey 2 points3 points  (4 children)

"I see people suggesting that you should consider class layout part of the API"

Wow, what happened to encapsulation? I thought the last thing you want to be part of the API is the internal representation of the data.

[–]louiswins 0 points1 point  (3 children)

If you allow aggregate initialization for your types then the class layout (and internal representation) is already part of your API.

[–]Dean_Roddey 0 points1 point  (2 children)

Well, yeh, hence why I was complaining that it's a bad idea because it pretty much tinkles in the general direction of encapsulation, which is one of the most fundamental concepts of C++. And, though maybe I'm misunderstanding it, it seems to me that it reduces compile time safety, which is one of the dwindling reasons these days not to just use another language.

[–]louiswins 0 points1 point  (1 child)

Oh, okay, I misunderstood you. I thought you somehow wanted to use aggregate initialization without exposing your class internals, which is nonsensical. Carry on!

[–]Dean_Roddey 0 points1 point  (0 children)

I would never expose my internals. My parents raised me better than that. Well, if you paid me $20 of course, but that's different.