Fix to compile under cpp23 again successfully

This commit is contained in:
2022-06-22 14:54:30 +02:00
parent a155041878
commit d811b9e470
5 changed files with 7 additions and 41 deletions

View File

@ -3,7 +3,6 @@ set(headers
src/espcrc32builder.h
src/esprandom.h
src/espstrutils.h
src/futurecpp.h
src/lockhelper.h
src/lockingqueue.h
src/recursivelockhelper.h

View File

@ -3,7 +3,9 @@
#include "sdkconfig.h"
#define LOG_LOCAL_LEVEL CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL
// system includes
#include <assert.h>
#include <utility>
// esp-idf includes
#include <esp_log.h>
@ -11,9 +13,6 @@
// 3rdparty lib includes
#include <fmt/core.h>
// local includes
#include "futurecpp.h"
using namespace std::string_literals;
namespace espcpputils {

View File

@ -1,30 +0,0 @@
#pragma once
// system includes
#include <cstring>
#include <limits>
#include <type_traits>
// C++20 backports (until espressif finally updates their aged compiler suite)
namespace std {
template <class To, class From>
typename std::enable_if_t<
sizeof(To) == sizeof(From) && std::is_trivially_copyable_v<From> && std::is_trivially_copyable_v<To>,
To>
// constexpr support needs compiler magic
bit_cast(const From& src) noexcept
{
static_assert(std::is_trivially_constructible_v<To>,
"This implementation additionally requires destination type to be trivially constructible");
To dst;
std::memcpy(&dst, &src, sizeof(To));
return dst;
}
template <typename EnumT, typename = std::enable_if_t<std::is_enum<EnumT>{}>>
constexpr std::underlying_type_t<EnumT> to_underlying(EnumT e) noexcept {
return static_cast<std::underlying_type_t<EnumT>>(e);
}
} // namespace std

View File

@ -3,12 +3,12 @@
#include "sdkconfig.h"
#define LOG_LOCAL_LEVEL CONFIG_ESPCPPUTILS_LOG_LOCAL_LEVEL
// system includes
#include <utility>
// esp-idf includes
#include <esp_log.h>
// local includes
#include "futurecpp.h"
namespace espcpputils {
namespace {
constexpr const char * const TAG = "ESPCPPUTILS";

View File

@ -3,17 +3,15 @@
// system includes
#include <utility>
#include <string_view>
#include <utility>
// espressif includes
// esp-idf includes
#include <esp_websocket_client.h>
#include <esp_transport_ws.h>
// 3rdparty lib includes
#include <fmt/core.h>
// local includes
#include "futurecpp.h"
namespace espcpputils {
class websocket_client
{