1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-06-01 14:51:45 +02:00

Create 1.5.1 branch

This commit is contained in:
Nick Blakely 2022-11-05 17:36:54 -07:00
parent 31625f7466
commit b31a72c7ad
3 changed files with 15 additions and 3 deletions

View File

@ -57,15 +57,15 @@
#define TSL_HH_THROW_OR_TERMINATE(ex, msg) throw ex(msg) #define TSL_HH_THROW_OR_TERMINATE(ex, msg) throw ex(msg)
#else #else
#define TSL_HH_NO_EXCEPTIONS #define TSL_HH_NO_EXCEPTIONS
#ifdef NDEBUG #ifdef TSL_DEBUG
#define TSL_HH_THROW_OR_TERMINATE(ex, msg) std::terminate()
#else
#include <iostream> #include <iostream>
#define TSL_HH_THROW_OR_TERMINATE(ex, msg) \ #define TSL_HH_THROW_OR_TERMINATE(ex, msg) \
do { \ do { \
std::cerr << msg << std::endl; \ std::cerr << msg << std::endl; \
std::terminate(); \ std::terminate(); \
} while (0) } while (0)
#else
#define TSL_HH_THROW_OR_TERMINATE(ex, msg) std::terminate()
#endif #endif
#endif #endif

View File

@ -35,6 +35,7 @@
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <memory> #include <memory>
#include <new>
#include <stdexcept> #include <stdexcept>
#include <tuple> #include <tuple>
#include <type_traits> #include <type_traits>
@ -309,12 +310,22 @@ class hopscotch_bucket : public hopscotch_bucket_hash<StoreHash> {
value_type& value() noexcept { value_type& value() noexcept {
tsl_hh_assert(!empty()); tsl_hh_assert(!empty());
#if defined(__cplusplus) && __cplusplus >= 201703L
return *std::launder(
reinterpret_cast<value_type*>(std::addressof(m_value)));
#else
return *reinterpret_cast<value_type*>(std::addressof(m_value)); return *reinterpret_cast<value_type*>(std::addressof(m_value));
#endif
} }
const value_type& value() const noexcept { const value_type& value() const noexcept {
tsl_hh_assert(!empty()); tsl_hh_assert(!empty());
#if defined(__cplusplus) && __cplusplus >= 201703L
return *std::launder(
reinterpret_cast<const value_type*>(std::addressof(m_value)));
#else
return *reinterpret_cast<const value_type*>(std::addressof(m_value)); return *reinterpret_cast<const value_type*>(std::addressof(m_value));
#endif
} }
template <typename... Args> template <typename... Args>

View File

@ -5,6 +5,7 @@
#include <memory> #include <memory>
#include <string> #include <string>
#include <string_view> #include <string_view>
#include <array>
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
// Basic game data types and macros // Basic game data types and macros