try compatible with old compilers

This commit is contained in:
mutouyun 2019-01-18 14:11:30 +08:00
parent 5ecbe21bc8
commit 99692221b7
3 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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

View File

@ -27,7 +27,11 @@ constexpr decltype(auto) static_switch(std::size_t i, std::index_sequence<N, I..
}
template <typename F, std::size_t...I>
#if __cplusplus >= 201703L
constexpr void static_for(std::index_sequence<I...>, F&& f) {
#else /*__cplusplus < 201703L*/
inline void static_for(std::index_sequence<I...>, F&& f) {
#endif/*__cplusplus < 201703L*/
[[maybe_unused]] auto expand = { (f(std::integral_constant<size_t, I>{}), 0)... };
}