From 99692221b7c11f86852f21f2a7dc8d5fdae1863f Mon Sep 17 00:00:00 2001 From: mutouyun Date: Fri, 18 Jan 2019 14:11:30 +0800 Subject: [PATCH] try compatible with old compilers --- build/ipc.pro | 2 +- build/test.pro | 2 +- src/memory/resource.hpp | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/build/ipc.pro b/build/ipc.pro index 6ed7355..5871c37 100644 --- a/build/ipc.pro +++ b/build/ipc.pro @@ -2,7 +2,7 @@ TEMPLATE = lib TARGET = ipc CONFIG -= qt -CONFIG += c++14 c++1z +CONFIG += c++14 c++17 c++1z !msvc:QMAKE_CXXFLAGS += -Wno-attributes -Wno-missing-field-initializers -Wno-unused-variable diff --git a/build/test.pro b/build/test.pro index c1b2635..3720cf8 100644 --- a/build/test.pro +++ b/build/test.pro @@ -4,7 +4,7 @@ QT += core testlib QT -= gui CONFIG += console -CONFIG += c++14 c++1z +CONFIG += c++14 c++17 c++1z CONFIG -= app_bundle DESTDIR = ../output diff --git a/src/memory/resource.hpp b/src/memory/resource.hpp index 548dab0..c3a6daf 100644 --- a/src/memory/resource.hpp +++ b/src/memory/resource.hpp @@ -27,7 +27,11 @@ constexpr decltype(auto) static_switch(std::size_t i, std::index_sequence +#if __cplusplus >= 201703L constexpr void static_for(std::index_sequence, F&& f) { +#else /*__cplusplus < 201703L*/ +inline void static_for(std::index_sequence, F&& f) { +#endif/*__cplusplus < 201703L*/ [[maybe_unused]] auto expand = { (f(std::integral_constant{}), 0)... }; }