@@ -19,14 +19,14 @@ namespace Aws
19
19
Optional () : m_value(nullptr ) {}
20
20
Optional (const T &val)
21
21
{
22
- new (& m_storage) T (val);
23
- m_value = reinterpret_cast <T *>(& m_storage);
22
+ new (m_storage) T (val);
23
+ m_value = reinterpret_cast <T *>(m_storage);
24
24
}
25
25
26
26
Optional (T &&val)
27
27
{
28
- new (& m_storage) T (std::forward<T>(val));
29
- m_value = reinterpret_cast <T *>(& m_storage);
28
+ new (m_storage) T (std::forward<T>(val));
29
+ m_value = reinterpret_cast <T *>(m_storage);
30
30
}
31
31
32
32
~Optional ()
@@ -45,8 +45,8 @@ namespace Aws
45
45
return *this ;
46
46
}
47
47
48
- new (& m_storage) T (std::forward<U>(u));
49
- m_value = reinterpret_cast <T *>(& m_storage);
48
+ new (m_storage) T (std::forward<U>(u));
49
+ m_value = reinterpret_cast <T *>(m_storage);
50
50
51
51
return *this ;
52
52
}
@@ -55,8 +55,8 @@ namespace Aws
55
55
{
56
56
if (other.m_value )
57
57
{
58
- new (& m_storage) T (*other.m_value );
59
- m_value = reinterpret_cast <T *>(& m_storage);
58
+ new (m_storage) T (*other.m_value );
59
+ m_value = reinterpret_cast <T *>(m_storage);
60
60
}
61
61
else
62
62
{
@@ -68,8 +68,8 @@ namespace Aws
68
68
{
69
69
if (other.m_value )
70
70
{
71
- new (& m_storage) T (std::forward<T>(*other.m_value ));
72
- m_value = reinterpret_cast <T *>(& m_storage);
71
+ new (m_storage) T (std::forward<T>(*other.m_value ));
72
+ m_value = reinterpret_cast <T *>(m_storage);
73
73
}
74
74
else
75
75
{
@@ -101,8 +101,8 @@ namespace Aws
101
101
102
102
if (other.m_value )
103
103
{
104
- new (& m_storage) T (*other.m_value );
105
- m_value = reinterpret_cast <T *>(& m_storage);
104
+ new (m_storage) T (*other.m_value );
105
+ m_value = reinterpret_cast <T *>(m_storage);
106
106
}
107
107
108
108
return *this ;
@@ -132,8 +132,8 @@ namespace Aws
132
132
133
133
if (other.m_value )
134
134
{
135
- new (& m_storage) T (*other.m_value );
136
- m_value = reinterpret_cast <T *>(& m_storage);
135
+ new (m_storage) T (*other.m_value );
136
+ m_value = reinterpret_cast <T *>(m_storage);
137
137
}
138
138
139
139
return *this ;
@@ -163,8 +163,8 @@ namespace Aws
163
163
164
164
if (other.m_value )
165
165
{
166
- new (& m_storage) T (std::forward<U>(*other.m_value ));
167
- m_value = reinterpret_cast <T *>(& m_storage);
166
+ new (m_storage) T (std::forward<U>(*other.m_value ));
167
+ m_value = reinterpret_cast <T *>(m_storage);
168
168
}
169
169
170
170
return *this ;
@@ -196,7 +196,7 @@ namespace Aws
196
196
}
197
197
198
198
private:
199
- typename std::aligned_storage< sizeof (T)>::type m_storage;
199
+ alignas (T) char m_storage[ sizeof (T)] ;
200
200
T *m_value;
201
201
};
202
202
} // namespace Crt
0 commit comments