Skip to content

Commit

Permalink
Replace deprecated std::aligned_storage with alignas, fixes #309 (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dobiasd authored Aug 8, 2024
1 parent cc7c01e commit 82bcb06
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion include/fplus/maybe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ class maybe {
}
}
bool is_present_;
typename std::aligned_storage<sizeof(T), alignof(T)>::type value_;
#ifdef _MSC_VER
__pragma(warning(push))
__pragma(warning(disable : 4324))
#endif
alignas(T) unsigned char value_[sizeof(T)];
#ifdef _MSC_VER
__pragma(warning(pop))
#endif
};

// API search type: is_just : Maybe a -> Bool
Expand Down
9 changes: 8 additions & 1 deletion include_all_in_one/include/fplus/fplus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2797,7 +2797,14 @@ class maybe {
}
}
bool is_present_;
typename std::aligned_storage<sizeof(T), alignof(T)>::type value_;
#ifdef _MSC_VER
__pragma(warning(push))
__pragma(warning(disable : 4324))
#endif
alignas(T) unsigned char value_[sizeof(T)];
#ifdef _MSC_VER
__pragma(warning(pop))
#endif
};

// API search type: is_just : Maybe a -> Bool
Expand Down

0 comments on commit 82bcb06

Please sign in to comment.