We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 55b8730 commit 61c089eCopy full SHA for 61c089e
source/basic.tex
@@ -3207,6 +3207,8 @@
3207
\end{note}
3208
\begin{example}
3209
\begin{codeblock}
3210
+// assumes that \tcode{sizeof(int)} is equal to 4
3211
+
3212
template<typename ...T>
3213
struct AlignedUnion {
3214
alignas(T...) unsigned char data[max(sizeof(T)...)];
@@ -3221,7 +3223,7 @@
3221
3223
3222
3224
struct A { unsigned char a[32]; };
3225
struct B { unsigned char b[16]; };
-A a;
3226
+alignas(int) A a;
3227
B *b = new (a.a + 8) B; // \tcode{a.a} provides storage for \tcode{*b}
3228
int *p = new (b->b + 4) int; // \tcode{b->b} provides storage for \tcode{*p}
3229
// \tcode{a.a} does not provide storage for \tcode{*p} (directly),
0 commit comments