config: decouple ENTT_NOEXCEPT and exceptions handling (close #867)

This commit is contained in:
Michele Caini
2022-04-19 09:09:25 +02:00
parent 7b87d17d22
commit aba2a6b17d
2 changed files with 8 additions and 5 deletions

2
TODO
View File

@@ -16,7 +16,7 @@ WIP:
* entity-only and exclude-only views
* custom allocators all over
* remove storage::patch
* use ENTT_NOEXCEPT_IF as appropriate (ie make compressed_pair conditionally noexcept)
* consider removing ENTT_NOEXCEPT, use ENTT_NOEXCEPT_IF (or noexcept(...)) as appropriate in any case (ie make compressed_pair conditionally noexcept)
WIP:
* add user data to type_info

View File

@@ -4,19 +4,22 @@
#include "version.h"
#if defined(__cpp_exceptions) && !defined(ENTT_NOEXCEPTION)
# define ENTT_NOEXCEPT noexcept
# define ENTT_NOEXCEPT_IF(expr) noexcept(expr)
# define ENTT_THROW throw
# define ENTT_TRY try
# define ENTT_CATCH catch(...)
#else
# define ENTT_NOEXCEPT
# define ENTT_NOEXCEPT_IF(...)
# define ENTT_THROW
# define ENTT_TRY if(true)
# define ENTT_CATCH if(false)
#endif
#ifndef ENTT_NOEXCEPT
# define ENTT_NOEXCEPT noexcept
# define ENTT_NOEXCEPT_IF(expr) noexcept(expr)
# else
# define ENTT_NOEXCEPT_IF(...)
#endif
#ifdef ENTT_USE_ATOMIC
# include <atomic>
# define ENTT_MAYBE_ATOMIC(Type) std::atomic<Type>