mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-02 23:37:47 +00:00
feat(Core): Enable C++20 support (#10440)
* feat(Core): Enable C++20 support * Update Duration.h * Revert "Update Duration.h" This reverts commit 177093e992c5d47d8c3b978c84857f5ecba12889. * maybe fix GCC * cherry-pick https://gcc.gnu.org/pipermail/gcc-cvs/2020-June/299715.html * Update Duration.h * Update Duration.h * Update Duration.h * Update Duration.h * Update Duration.h * Update Duration.h * Update Duration.h * Revert "Update Duration.h" This reverts commit dc4e2ce281dd1a33cfac5be56488a3b96131bfd5. * Update Duration.h * Update Duration.h * Update Duration.h * cleanup * more cleanup * maybe fix build * restore advstd::type_identity because GCC8 is garbage * Update advstd.h * fix gcc8 💤 * Update CMakeLists.txt * Update CMakeLists.txt * Update src/common/Utilities/advstd.h Co-authored-by: Francesco Borzì <borzifrancesco@gmail.com>
This commit is contained in:
@@ -35,7 +35,22 @@ using Minutes = std::chrono::minutes;
|
||||
/// Hours shorthand typedef.
|
||||
using Hours = std::chrono::hours;
|
||||
|
||||
#if __cplusplus > 201703L
|
||||
// Workaround for GCC and Clang 10 in C++20
|
||||
#if defined(__GNUC__) && (!defined(__clang__) || (__clang_major__ == 10))
|
||||
/// Days shorthand typedef.
|
||||
using Days = std::chrono::duration<__INT64_TYPE__, std::ratio<86400>>;
|
||||
|
||||
/// Weeks shorthand typedef.
|
||||
using Weeks = std::chrono::duration<__INT64_TYPE__, std::ratio<604800>>;
|
||||
|
||||
/// Years shorthand typedef.
|
||||
using Years = std::chrono::duration<__INT64_TYPE__, std::ratio<31556952>>;
|
||||
|
||||
/// Months shorthand typedef.
|
||||
using Months = std::chrono::duration<__INT64_TYPE__, std::ratio<2629746>>;
|
||||
|
||||
#else
|
||||
|
||||
/// Days shorthand typedef.
|
||||
using Days = std::chrono::days;
|
||||
|
||||
@@ -47,19 +62,8 @@ using Years = std::chrono::years;
|
||||
|
||||
/// Months shorthand typedef.
|
||||
using Months = std::chrono::months;
|
||||
#else
|
||||
/// Days shorthand typedef. (delete after start support c++20)
|
||||
using Days = std::chrono::duration<int, std::ratio_multiply<std::ratio<24>, Hours::period>>;
|
||||
|
||||
/// Weeks shorthand typedef. (delete after start support c++20)
|
||||
using Weeks = std::chrono::duration<int, std::ratio_multiply<std::ratio<7>, Days::period>>;
|
||||
|
||||
/// Years shorthand typedef. (delete after start support c++20)
|
||||
using Years = std::chrono::duration<int, std::ratio_multiply<std::ratio<146097, 400>, Days::period>>;
|
||||
|
||||
/// Months shorthand typedef. (delete after start support c++20)
|
||||
using Months = std::chrono::duration<int, std::ratio_divide<Years::period, std::ratio<12>>>;
|
||||
#endif
|
||||
#endif // GCC_VERSION
|
||||
|
||||
/// time_point shorthand typedefs
|
||||
using TimePoint = std::chrono::steady_clock::time_point;
|
||||
|
||||
Reference in New Issue
Block a user