mirror of
https://gitee.com/an-tao/drogon.git
synced 2024-12-02 03:38:03 +08:00
Make the 'any' works correctly with either C++17 or C++14
This commit is contained in:
parent
42c23864c4
commit
6ebae287a3
@ -10,14 +10,17 @@ IF (CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||
stop()
|
||||
elseif(version LESS 7.1.0)
|
||||
set(CMAKE_CXX_STD_FLAGS c++14)
|
||||
set(CXX_STD 14)
|
||||
MESSAGE(STATUS "c++14")
|
||||
else()
|
||||
set(CMAKE_CXX_STD_FLAGS c++17)
|
||||
set(CXX_STD 17)
|
||||
MESSAGE(STATUS "c++17")
|
||||
endif()
|
||||
else()
|
||||
#MacOS use c++17
|
||||
set(CMAKE_CXX_STD_FLAGS c++17)
|
||||
set(CXX_STD 17)
|
||||
endif()
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR}/trantor ${PROJECT_SOURCE_DIR}/lib/inc ${PROJECT_SOURCE_DIR}/orm_lib/inc)
|
||||
@ -131,7 +134,7 @@ SET(CONFIG_HEADER "${PROJECT_SOURCE_DIR}/config.h")
|
||||
file(WRITE "${CONFIG_HEADER}" "#pragma once\n")
|
||||
|
||||
file(APPEND "${CONFIG_HEADER}" "#include <trantor/utils/config.h>\n")
|
||||
|
||||
file(APPEND "${CONFIG_HEADER}" "#define CXX_STD " ${CXX_STD} "\n")
|
||||
if(USE_ORM)
|
||||
file(APPEND "${CONFIG_HEADER}" "#define USE_ORM 1\n")
|
||||
if(PostgreSQL_FOUND)
|
||||
|
@ -88,8 +88,11 @@ void HttpServer::onConnection(const TcpConnectionPtr &conn)
|
||||
{
|
||||
_disconnectWebsocketCallback(requestParser->webSocketConn());
|
||||
}
|
||||
//conn->getMutableContext()->reset(); reset() is in c++17
|
||||
conn->setContext(0);
|
||||
#if (CXX_STD > 14)
|
||||
conn->getMutableContext()->reset(); //reset(): since c++17
|
||||
#else
|
||||
conn->getMutableContext()->clear();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
_connectionCallback(conn);
|
||||
|
Loading…
Reference in New Issue
Block a user