Skip to content

Commit 4159da7

Browse files
authored
Merge pull request #52 from LucidSigma/remove-deprecated-aligned-storage
2 parents bf6c7ab + ac5634f commit 4159da7

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

include/async++/task_base.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ struct task_base_deleter {
166166
template<typename Result>
167167
struct task_result_holder: public task_base {
168168
union {
169-
typename std::aligned_storage<sizeof(Result), std::alignment_of<Result>::value>::type result;
170-
std::aligned_storage<sizeof(std::exception_ptr), std::alignment_of<std::exception_ptr>::value>::type except;
169+
alignas(Result) std::uint8_t result[sizeof(Result)];
170+
alignas(std::exception_ptr) std::uint8_t except[sizeof(std::exception_ptr)];
171171

172172
// Scheduler that should be used to schedule this task. The scheduler
173173
// type has been erased and is held by vtable->schedule.
@@ -208,7 +208,7 @@ struct task_result_holder<Result&>: public task_base {
208208
union {
209209
// Store as pointer internally
210210
Result* result;
211-
std::aligned_storage<sizeof(std::exception_ptr), std::alignment_of<std::exception_ptr>::value>::type except;
211+
alignas(std::exception_ptr) std::uint8_t except[sizeof(std::exception_ptr)];
212212
void* sched;
213213
};
214214

@@ -233,7 +233,7 @@ struct task_result_holder<Result&>: public task_base {
233233
template<>
234234
struct task_result_holder<fake_void>: public task_base {
235235
union {
236-
std::aligned_storage<sizeof(std::exception_ptr), std::alignment_of<std::exception_ptr>::value>::type except;
236+
alignas(std::exception_ptr) std::uint8_t except[sizeof(std::exception_ptr)];
237237
void* sched;
238238
};
239239

@@ -344,7 +344,7 @@ struct func_base<Func, typename std::enable_if<std::is_empty<Func>::value>::type
344344
// Class to hold a function object and initialize/destroy it at any time
345345
template<typename Func, typename = void>
346346
struct func_holder {
347-
typename std::aligned_storage<sizeof(Func), std::alignment_of<Func>::value>::type func;
347+
alignas(Func) std::uint8_t func[sizeof(Func)];
348348

349349
Func& get_func()
350350
{

src/singleton.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ template<typename T>
3939
class singleton {
4040
std::mutex lock;
4141
std::atomic<bool> init_flag;
42-
typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type storage;
42+
alignas(T) std::uint8_t storage[sizeof(T)];
4343

4444
static singleton instance;
4545

src/task_wait_event.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ enum wait_type {
3535
//
3636
// The event object is lazily initialized to avoid unnecessary API calls.
3737
class task_wait_event {
38-
std::aligned_storage<sizeof(std::mutex), std::alignment_of<std::mutex>::value>::type m;
39-
std::aligned_storage<sizeof(std::condition_variable), std::alignment_of<std::condition_variable>::value>::type c;
38+
alignas(std::mutex) std::uint8_t m[sizeof(std::mutex)];
39+
alignas(std::condition_variable) std::uint8_t c[sizeof(std::condition_variable)];
4040
int event_mask;
4141
bool initialized;
4242

0 commit comments

Comments
 (0)