diff --git a/CMakeLists.txt b/CMakeLists.txt index f0c6fe08..a896ec88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,7 @@ include (GenerateExportHeader) set(CMAKE_OSX_RPATH 1) set(CMAKE_OSX_DEPLOYMENT_TARGET "10.12" CACHE STRING "Minimum OS X deployment version") -set(CMAKE_CXX_STANDARD 14) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) # read 'version' file into a variable (stripping any newlines or spaces) @@ -444,7 +444,7 @@ if(WIN32) endif() if(MSVC) - set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP") + set(MSVC_FLAGS "-D_HAS_STD_BYTE=0 -DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /MP /bigobj") if (X86) set(SIMD_COMPILER_FLAGS "/arch:SSE /arch:SSE2") endif() @@ -455,11 +455,6 @@ if(WIN32) # symbols. Suspect this may be an OSG-DB export bug set( MSVC_LD_FLAGS "/FORCE:MULTIPLE" ) endif () - - if (${MSVC_VERSION} GREATER 1899) - # needed for debug builds with VS2015 - set( MSVC_FLAGS "${MSVC_FLAGS} /bigobj" ) - endif() endif(MSVC) # assumed on Windows diff --git a/simgear/bvh/BVHStaticGeometryBuilder.hxx b/simgear/bvh/BVHStaticGeometryBuilder.hxx index b390d931..0cce7c72 100644 --- a/simgear/bvh/BVHStaticGeometryBuilder.hxx +++ b/simgear/bvh/BVHStaticGeometryBuilder.hxx @@ -62,7 +62,7 @@ public: }; typedef std::list LeafRefList; - struct LeafRefLess : public std::binary_function { + struct LeafRefLess { LeafRefLess(unsigned sortAxis) : _sortAxis(sortAxis) {} bool operator()(const LeafRef& x, const LeafRef& y) { return x._center[_sortAxis] < y._center[_sortAxis]; } diff --git a/simgear/nasal/cppbind/NasalString.cxx b/simgear/nasal/cppbind/NasalString.cxx old mode 100644 new mode 100755 index dd3cb5ab..00ca3ae3 --- a/simgear/nasal/cppbind/NasalString.cxx +++ b/simgear/nasal/cppbind/NasalString.cxx @@ -28,28 +28,6 @@ namespace nasal { - /** - * Predicate (eg. for std::find_if) returning true if no character of the - * stored string given by the range [begin, end) matches. - */ - struct no_match: - public std::unary_function - { - no_match(const char* begin, const char* end): - _begin(begin), - _end(end) - {} - - bool operator()(const char c) const - { - return std::find(_begin, _end, c) == _end; - } - - private: - const char* _begin; - const char* _end; - }; - //template //Iterator //rfind_first_of( Iterator rbegin_src, Iterator rend_src, @@ -171,8 +149,9 @@ namespace nasal if( pos >= size() ) return npos; - const char* result = std::find_if( begin() + pos, end(), - no_match(chr.begin(), chr.end()) ); + const char* result = std::find_if(begin() + pos, end(), [&chr](const char c) { + return std::find(chr.begin(), chr.end(), c) == chr.end(); + }); return result != end() ? result - begin() : npos; } diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx old mode 100644 new mode 100755 index b7bf5367..433c80fe --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -2829,25 +2829,25 @@ size_t hash_value(const SGPropertyNode& node) return 0; case props::BOOL: - return hash_value(node.getValue()); + return boost::hash_value(node.getValue()); case props::INT: - return hash_value(node.getValue()); + return boost::hash_value(node.getValue()); case props::LONG: - return hash_value(node.getValue()); + return boost::hash_value(node.getValue()); case props::FLOAT: - return hash_value(node.getValue()); + return boost::hash_value(node.getValue()); case props::DOUBLE: - return hash_value(node.getValue()); + return boost::hash_value(node.getValue()); case props::STRING: case props::UNSPECIFIED: { const char *val = node.getStringValue(); - return hash_range(val, val + strlen(val)); + return boost::hash_range(val, val + strlen(val)); } case props::VEC3D: { const SGVec3d val = node.getValue(); - return hash_range(&val[0], &val[3]); + return boost::hash_range(&val[0], &val[3]); } case props::VEC4D: { diff --git a/simgear/scene/material/makeEffect.cxx b/simgear/scene/material/makeEffect.cxx index b006990e..5e8d2a51 100644 --- a/simgear/scene/material/makeEffect.cxx +++ b/simgear/scene/material/makeEffect.cxx @@ -57,19 +57,6 @@ OpenThreads::ReentrantMutex effectMutex; * Nodes are considered equal if their names and indexes are equal. */ -struct PropPredicate - : public unary_function -{ - PropPredicate(const SGPropertyNode* node_) : node(node_) {} - bool operator()(const SGPropertyNode* arg) const - { - if (strcmp(node->getName(), arg->getName())) - return false; - return node->getIndex() == arg->getIndex(); - } - const SGPropertyNode* node; -}; - namespace effect { void mergePropertyTrees(SGPropertyNode* resultNode, @@ -86,9 +73,12 @@ void mergePropertyTrees(SGPropertyNode* resultNode, // Merge identical nodes for (int i = 0; i < right->nChildren(); ++i) { const SGPropertyNode* node = right->getChild(i); - RawPropVector::iterator litr - = find_if(leftChildren.begin(), leftChildren.end(), - PropPredicate(node)); + auto litr = find_if(leftChildren.begin(), leftChildren.end(), + [node](const SGPropertyNode* arg) { + if (strcmp(node->getName(), arg->getName())) + return false; + return node->getIndex() == arg->getIndex(); + }); SGPropertyNode* newChild = resultNode->getChild(node->getName(), node->getIndex(), true); if (litr != leftChildren.end()) { diff --git a/simgear/structure/OSGUtils.hxx b/simgear/structure/OSGUtils.hxx index 645ed76f..40291d74 100644 --- a/simgear/structure/OSGUtils.hxx +++ b/simgear/structure/OSGUtils.hxx @@ -24,58 +24,6 @@ #include #include -namespace simgear -{ -// RefPtrAdapter also appears in OpenSceneGraph's -// osgDB/DatabasePager.cpp. I wrote that code too. -- Tim Moore - -// Convert function objects that take pointer args into functions that a -// reference to an osg::ref_ptr. This is quite useful for doing STL -// operations on lists of ref_ptr. This code assumes that a function -// with an argument const Foo* should be composed into a function of -// argument type ref_ptr&, not ref_ptr&. Some support -// for that should be added to make this more general. -template -struct PointerTraits -{ - typedef class NullType {} PointeeType; -}; - -template -struct PointerTraits -{ - typedef U PointeeType; -}; - -template -struct PointerTraits -{ - typedef U PointeeType; -}; - -template -class RefPtrAdapter - : public std::unary_function::PointeeType>, - typename FuncObj::result_type> -{ -public: - typedef typename PointerTraits::PointeeType PointeeType; - typedef osg::ref_ptr RefPtrType; - explicit RefPtrAdapter(const FuncObj& funcObj) : _func(funcObj) {} - typename FuncObj::result_type operator()(const RefPtrType& refPtr) const - { - return _func(refPtr.get()); - } -protected: - FuncObj _func; -}; - -template -RefPtrAdapter refPtrAdapt(const FuncObj& func) -{ - return RefPtrAdapter(func); -} -} /** Typesafe wrapper around OSG's object clone function. Something * very similar is in current OSG sources. */