Unused variable warning (issue #208) and remove c++17 dependency.

This commit is contained in:
greg7mdp
2023-09-29 10:36:21 -04:00
parent 81ca453769
commit a7909d547c
2 changed files with 28 additions and 26 deletions
+4 -4
View File
@@ -1271,8 +1271,8 @@ public:
if (empty())
return;
if (capacity_) {
if constexpr (!std::is_trivially_destructible<typename PolicyTraits::value_type>::value ||
std::is_same<typename Policy::is_flat, std::false_type>::value) {
PHMAP_IF_CONSTEXPR((!std::is_trivially_destructible<typename PolicyTraits::value_type>::value ||
std::is_same<typename Policy::is_flat, std::false_type>::value)) {
// node map or not trivially destructible... we need to iterate and destroy values one by one
for (size_t i = 0; i != capacity_; ++i) {
if (IsFull(ctrl_[i])) {
@@ -2009,8 +2009,8 @@ private:
if (!capacity_)
return;
if constexpr (!std::is_trivially_destructible<typename PolicyTraits::value_type>::value ||
std::is_same<typename Policy::is_flat, std::false_type>::value) {
PHMAP_IF_CONSTEXPR((!std::is_trivially_destructible<typename PolicyTraits::value_type>::value ||
std::is_same<typename Policy::is_flat, std::false_type>::value)) {
// node map, or not trivially destructible... we need to iterate and destroy values one by one
// std::cout << "either this is a node map or " << type_name<typename PolicyTraits::value_type>() << " is not trivially_destructible\n";
for (size_t i = 0; i != capacity_; ++i) {
+24 -22
View File
@@ -654,82 +654,84 @@ namespace base_internal {
namespace {
#ifdef PHMAP_HAVE_EXCEPTIONS
#define PHMAP_THROW_IMPL(e) throw e
#define PHMAP_THROW_IMPL_MSG(e, message) throw e(message)
#define PHMAP_THROW_IMPL(e) throw e()
#else
#define PHMAP_THROW_IMPL(...) std::abort()
#define PHMAP_THROW_IMPL_MSG(e, message) do { (void)(message); std::abort(); } while(0)
#define PHMAP_THROW_IMPL(e) std::abort()
#endif
} // namespace
static inline void ThrowStdLogicError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::logic_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::logic_error, what_arg);
}
static inline void ThrowStdLogicError(const char* what_arg) {
PHMAP_THROW_IMPL(std::logic_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::logic_error, what_arg);
}
static inline void ThrowStdInvalidArgument(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::invalid_argument(what_arg));
PHMAP_THROW_IMPL_MSG(std::invalid_argument, what_arg);
}
static inline void ThrowStdInvalidArgument(const char* what_arg) {
PHMAP_THROW_IMPL(std::invalid_argument(what_arg));
PHMAP_THROW_IMPL_MSG(std::invalid_argument, what_arg);
}
static inline void ThrowStdDomainError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::domain_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::domain_error, what_arg);
}
static inline void ThrowStdDomainError(const char* what_arg) {
PHMAP_THROW_IMPL(std::domain_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::domain_error, what_arg);
}
static inline void ThrowStdLengthError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::length_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::length_error, what_arg);
}
static inline void ThrowStdLengthError(const char* what_arg) {
PHMAP_THROW_IMPL(std::length_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::length_error, what_arg);
}
static inline void ThrowStdOutOfRange(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::out_of_range(what_arg));
PHMAP_THROW_IMPL_MSG(std::out_of_range, what_arg);
}
static inline void ThrowStdOutOfRange(const char* what_arg) {
PHMAP_THROW_IMPL(std::out_of_range(what_arg));
PHMAP_THROW_IMPL_MSG(std::out_of_range, what_arg);
}
static inline void ThrowStdRuntimeError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::runtime_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::runtime_error, what_arg);
}
static inline void ThrowStdRuntimeError(const char* what_arg) {
PHMAP_THROW_IMPL(std::runtime_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::runtime_error, what_arg);
}
static inline void ThrowStdRangeError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::range_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::range_error, what_arg);
}
static inline void ThrowStdRangeError(const char* what_arg) {
PHMAP_THROW_IMPL(std::range_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::range_error, what_arg);
}
static inline void ThrowStdOverflowError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::overflow_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::overflow_error, what_arg);
}
static inline void ThrowStdOverflowError(const char* what_arg) {
PHMAP_THROW_IMPL(std::overflow_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::overflow_error, what_arg);
}
static inline void ThrowStdUnderflowError(const std::string& what_arg) {
PHMAP_THROW_IMPL(std::underflow_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::underflow_error, what_arg);
}
static inline void ThrowStdUnderflowError(const char* what_arg) {
PHMAP_THROW_IMPL(std::underflow_error(what_arg));
PHMAP_THROW_IMPL_MSG(std::underflow_error, what_arg);
}
static inline void ThrowStdBadFunctionCall() {
PHMAP_THROW_IMPL(std::bad_function_call());
PHMAP_THROW_IMPL(std::bad_function_call);
}
static inline void ThrowStdBadAlloc() {
PHMAP_THROW_IMPL(std::bad_alloc());
PHMAP_THROW_IMPL(std::bad_alloc);
}
} // namespace base_internal