From 17a83d045360583f8508dcccd77f411c7ab74fe3 Mon Sep 17 00:00:00 2001 From: Tobias Frisch <tfrisch@uni-koblenz.de> Date: Sun, 19 Mar 2023 17:16:44 +0100 Subject: [PATCH] Add branching for unordered container types Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de> --- CMakeLists.txt | 5 +++++ include/vkcv/Container.hpp | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaeb4203..cb2c664c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,6 +90,11 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSI list(APPEND vkcv_definitions __NO_SEMAPHORES__) endif() +if (((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "4.0.0")) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0"))) + list(APPEND vkcv_definitions VKCV_UNORDERED_CONTAINER) +endif() + # configure everything to use the required dependencies include(${vkcv_config}/Libraries.cmake) diff --git a/include/vkcv/Container.hpp b/include/vkcv/Container.hpp index 20c79557..56e1199c 100644 --- a/include/vkcv/Container.hpp +++ b/include/vkcv/Container.hpp @@ -6,18 +6,36 @@ */ #include <vector> + +#ifdef VKCV_UNORDERED_CONTAINER #include <unordered_map> #include <unordered_set> +#else +#include <map> +#include <set> +#endif namespace vkcv { - template<typename K, typename V> - using Dictionary = std::unordered_map<K, V>; - template<typename T> using Vector = std::vector<T>; + +#ifdef VKCV_UNORDERED_CONTAINER + template<typename K, typename V> + using Dictionary = std::unordered_map<K, V>; + template<typename T> using Set = std::unordered_set<T>; + +#else + + template<typename K, typename V> + using Dictionary = std::map<K, V>; + template<typename T> + using Set = std::set<T>; + +#endif + } -- GitLab