From c3a7fc2aabeeefc6cbf6729cb67199bc6b91f1da Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 10 Jul 2019 12:57:19 +0200 Subject: [PATCH] Switch to C++17 --- CMakeLists.txt | 4 ++-- libsrc/general/ngarray.hpp | 7 +------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ed6c3e55..2e899ac1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ if(WIN32) # we are linking to object libraries on Windows cmake_minimum_required(VERSION 3.12) else(WIN32) - cmake_minimum_required(VERSION 3.1.3) + cmake_minimum_required(VERSION 3.8) endif(WIN32) if(NOT WIN32) @@ -216,7 +216,7 @@ macro(get_dll_from_lib dll_path lib_path) get_filename_component(lib_name ${lib} name) endmacro() -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) if(WIN32) get_WIN32_WINNT(ver) add_definitions(-D_WIN32_WINNT=${ver} -DWNT -DWNT_WINDOW -DNOMINMAX) diff --git a/libsrc/general/ngarray.hpp b/libsrc/general/ngarray.hpp index e819fcc2..2c4aed21 100644 --- a/libsrc/general/ngarray.hpp +++ b/libsrc/general/ngarray.hpp @@ -429,16 +429,11 @@ namespace netgen T * p = new T[nsize]; size_t mins = (nsize < size) ? nsize : size; - // memcpy (p, data, mins * sizeof(T)); -#if defined(__GNUG__) && __GNUC__ < 5 && !defined(__clang__) - for (size_t i = 0; i < mins; i++) p[i] = move(data[i]); -#else - if (std::is_trivially_copyable::value) + if constexpr(std::is_trivially_copyable::value) memcpy (p, data, sizeof(T)*mins); else for (size_t i = 0; i < mins; i++) p[i] = move(data[i]); -#endif if (ownmem) delete [] data;