From 2ddd4b44b900ff718b856ac54d9f99f31e091087 Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Sat, 24 Feb 2018 10:29:24 +0800 Subject: [PATCH] Sketcher: add geo history to resuse deleted geo id The behavior is controlled by the following parameter: BaseApp/Preferences/Mod/Sketcher/GeoHistoryLevel 0 : disable, 1(default) : reuse id only if the new geometries's both start and end points matches some deleted geometry, 2 : resuse id when either start or end points matches some deleted geometry. It works like this. The sketch object will keep an adjacency list of each existing geometries. Every time the geometry changes, a new boost::geometry::retree is built based on existing vertex positions. The adjacency list is updated while the rtree is built. The list will sychronize the adjacency id list of all existing geometry, but keep any delete geometry id unchanged. When new geometry is created, sketch object will query the rtree based on the start and end points of the new geometry, and try to find any deleted geometries id's that are connected to the same existing geometries that owns the hitting points, and reuse its id. The net effect is that, say, when you delete an edge in a square, and replace it with a bspline, the bspline will have the exact same id as the deleted line. So, if you only delete and replace one edge at a time, you can change the type of all edges while keeping the same id's. Moving points during the process will not have any negative effect. --- src/Mod/Sketcher/App/SketchObject.cpp | 400 ++++++++++++++---- src/Mod/Sketcher/App/SketchObject.h | 23 +- .../container/detail/memory_util.hpp | 83 ++++ .../has_member_function_callable_with.hpp | 365 ++++++++++++++++ .../intrusive/detail/memory_util.hpp | 292 +++++++++++++ 5 files changed, 1067 insertions(+), 96 deletions(-) create mode 100644 src/Mod/Sketcher/App/boost_fix/container/detail/memory_util.hpp create mode 100644 src/Mod/Sketcher/App/boost_fix/intrusive/detail/has_member_function_callable_with.hpp create mode 100644 src/Mod/Sketcher/App/boost_fix/intrusive/detail/memory_util.hpp diff --git a/src/Mod/Sketcher/App/SketchObject.cpp b/src/Mod/Sketcher/App/SketchObject.cpp index 41c6d993da7f..856bd1248cd2 100644 --- a/src/Mod/Sketcher/App/SketchObject.cpp +++ b/src/Mod/Sketcher/App/SketchObject.cpp @@ -64,10 +64,22 @@ //# include #endif +#include +#include +#if defined(BOOST_MSVC) && (BOOST_VERSION == 105500) +// for fixing issue https://svn.boost.org/trac/boost/ticket/9332 +# include "boost_fix/intrusive/detail/memory_util.hpp" +# include "boost_fix/container/detail/memory_util.hpp" +#endif +#include +#include +#include +#include + #include #include -#include +#include #include #include #include @@ -114,7 +126,11 @@ SketchObject::SketchObject() ADD_PROPERTY_TYPE(Exports, (0) ,"Sketch",(App::PropertyType)(App::Prop_Hidden),"Sketch export geometry"); ADD_PROPERTY_TYPE(LastGeoID, (0) ,"Sketch",(App::PropertyType)(App::Prop_Output|App::Prop_Hidden|App::Prop_ReadOnly),"For generating geometry ID"); - geoCached = false; + geoLastId = 0; + + ParameterGrp::handle hGrpp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Sketcher"); + geoHistoryLevel = hGrpp->GetInt("GeometryHistoryLevel",1); + allowOtherBody = true; allowUnaligned = true; @@ -297,6 +313,218 @@ int SketchObject::solve(bool updateGeoAfterSolving/*=true*/) return err; } +namespace bg = boost::geometry; +namespace bgi = boost::geometry::index; + +BOOST_GEOMETRY_REGISTER_POINT_3D( + Base::Vector3d,double,bg::cs::cartesian,x,y,z) + +class SketchObject::GeoHistory { +public: + typedef bgi::linear<16> Parameters; + + typedef std::set IdSet; + typedef std::pair IdSets; + typedef std::list AdjList; + + //associate a geo with connected ones on both points + typedef std::map AdjMap; + + // maps start/end points to all existing geo to query and update adjacencies + typedef std::pair Value; + + AdjList adjlist; + AdjMap adjmap; + bgi::rtree rtree; + + AdjList::iterator find(const Base::Vector3d &pt,bool strict=true){ + std::vector ret; + rtree.query(bgi::nearest(pt,1),std::back_inserter(ret)); + if(ret.size()) { + // NOTE: we are using square distance here, the 1e-6 threshold is + // very forgiving. You should have used Precision::SquareConfisuion(), + // which is 1e-14. However, there is a problem with current + // commandGeoCreate. They create new geometry with initial point of + // the exact mouse position, instead of the pre-selected point + // position, and rely on auto constraint to snap in the new + // geometry. So, we cannot use a very strict threshold here. + double tol = strict?Precision::SquareConfusion()*10:1e-6; + double d = Base::DistanceP2(ret[0].first,pt); + if(dinsert(id); + } + + void finishUpdate(const std::map &geomap) { + IdSet oldset; + for(auto &idset : adjlist) { + oldset.clear(); + for(long _id : idset) { + long id = abs(_id); + auto &v = adjmap[id]; + auto &adj = _id>0?v.first:v.second; + for(auto it=adj.begin(),itNext=it;it!=adj.end();it=itNext) { + ++itNext; + long other = *it; + if(geomap.find(other) == geomap.end()) { + // remember those deleted id's + oldset.insert(other); + FC_TRACE("insert old " << id << ", " << other); + } else if(idset.find(other)==idset.end()) { + // delete any existing id's that are no longer in the adj list + FC_TRACE("erase " << id << ", " << other); + adj.erase(it); + } + } + // now merge the current ones + for(long _id2 : idset) { + long id2 = abs(_id2); + if(id!=id2) { + adj.insert(id2); + FC_TRACE("insert new " << id << ", " << id2); + } + } + } + // now reset the adjacency list with only those deleted id's, + // because the whole purpose of this history is to try to reuse + // deleted id. + idset.swap(oldset); + } + } + + AdjList::iterator end() { + return adjlist.end(); + } + + size_t size() { + return rtree.size(); + } +}; + +void SketchObject::updateGeoHistory() { + if(!geoHistoryLevel) return; + + if(!geoHistory) + geoHistory.reset(new GeoHistory); + + FC_TIME_INIT(t); + const auto &geos = getInternalGeometry(); + geoHistory->clear(); + for(int i=0;i<(int)geos.size();++i) { + auto geo = geos[i]; + auto pstart = getPoint(geo,start); + auto pend = getPoint(geo,end); + geoHistory->update(pstart,geo->Id); + if(pstart!=pend) + geoHistory->update(pend,-geo->Id); + } + geoHistory->finishUpdate(geoMap); + FC_TIME_LOG(t,"update geometry history (" << geoHistory->size() << ", " << geoMap.size()<<')'); +} + +#define GEN_ID(geo) do {\ + generateId(geo); \ + FC_LOG("generate id " << geo->Id << ", " << geoLastId);\ + }while(0); + +void SketchObject::generateId(Part::Geometry *geo) { + if(!geoHistoryLevel) { + geo->Id = ++geoLastId; + geoMap[geo->Id] = (long)Geometry.getSize(); + return; + } + + if(!geoHistory) + updateGeoHistory(); + + // Search geo histroy to see if the start point and end point belongs to + // some deleted geometries. Prefer matching both start and end point. If + // can't then try start and then end. Generate new id if none is found. + auto pstart = getPoint(geo,start); + auto it = geoHistory->find(pstart,false); + auto pend = getPoint(geo,end); + auto it2 = it; + if(pstart!=pend) { + it2 = geoHistory->find(pend,false); + if(it2 == geoHistory->end()) + it2 = it; + } + long newId = -1; + std::vector found; + + if(geoHistoryLevel<=1 && (it==geoHistory->end() || it2==it)) { + // level<=1 means we only reuse id if both start and end matches + newId = ++geoLastId; + goto END; + } + + if(it!=geoHistory->end()) { + for(long id : *it) { + if(geoMap.find(id)==geoMap.end()) { + if(it2 == it) { + newId = id; + goto END; + } + found.push_back(id); + }else + FC_TRACE("ignore " << id); + } + } + if(it2!=it) { + if(found.empty()) { + // no candidate exists + for(long id : *it2) { + if(geoMap.find(id)==geoMap.end()) { + newId = id; + goto END; + } + FC_TRACE("ignore " << id); + } + }else{ + // already some candidate exists, search for matching of both + // points + for(long id : found) { + if(it2->find(id)!=it2->end()) { + newId = id; + goto END; + } + FC_TRACE("ignore " << id); + } + } + } + if(found.size()) { + FC_TRACE("found " << found.front()); + newId = found.front(); + }else + newId = ++geoLastId; +END: + geo->Id = newId; + geoMap[newId] = (long)Geometry.getSize(); +} + int SketchObject::setDatum(int ConstrId, double Datum) { // set the changed value for the constraint @@ -556,12 +784,7 @@ int SketchObject::movePoint(int GeoId, PointPos PosId, const Base::Vector3d& toP return lastSolverStatus; } -Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const -{ - if(!(GeoId == H_Axis || GeoId == V_Axis - || (GeoId <= getHighestCurveIndex() && GeoId >= -getExternalGeometryCount()) )) - throw Base::Exception("SketchObject::getPoint. Invalid GeoId was supplied."); - const Part::Geometry *geo = getGeometry(GeoId); +Base::Vector3d SketchObject::getPoint(const Part::Geometry *geo, PointPos PosId) { if (geo->getTypeId() == Part::GeomPoint::getClassTypeId()) { const Part::GeomPoint *p = static_cast(geo); if (PosId == start || PosId == mid || PosId == end) @@ -574,12 +797,14 @@ Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const return lineSeg->getEndPoint(); } else if (geo->getTypeId() == Part::GeomCircle::getClassTypeId()) { const Part::GeomCircle *circle = static_cast(geo); - if (PosId == mid) - return circle->getCenter(); + auto pt = circle->getCenter(); + if(PosId == end) + pt.x += circle->getRadius(); } else if (geo->getTypeId() == Part::GeomEllipse::getClassTypeId()) { const Part::GeomEllipse *ellipse = static_cast(geo); - if (PosId == mid) - return ellipse->getCenter(); + auto pt = ellipse->getCenter(); + if(PosId == end) + pt = ellipse->getMajorAxisDir()*ellipse->getMajorRadius(); } else if (geo->getTypeId() == Part::GeomArcOfCircle::getClassTypeId()) { const Part::GeomArcOfCircle *aoc = static_cast(geo); if (PosId == start) @@ -619,10 +844,18 @@ Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const else if (PosId == end) return bsp->getEndPoint(); } - return Base::Vector3d(); } +Base::Vector3d SketchObject::getPoint(int GeoId, PointPos PosId) const +{ + if(!(GeoId == H_Axis || GeoId == V_Axis + || (GeoId <= getHighestCurveIndex() && GeoId >= -getExternalGeometryCount()) )) + throw Base::Exception("SketchObject::getPoint. Invalid GeoId was supplied."); + const Part::Geometry *geo = getGeometry(GeoId); + return getPoint(geo,PosId); +} + int SketchObject::getAxisCount(void) const { const std::vector< Part::Geometry * > &vals = getInternalGeometry(); @@ -707,14 +940,13 @@ std::vector SketchObject::supportedGeometry(const std::vector< int SketchObject::addGeometry(const std::vector &geoList, bool construction/*=false*/) { const std::vector< Part::Geometry * > &vals = getInternalGeometry(); - auto id = LastGeoID.getValue(); std::vector< Part::Geometry * > newVals(vals); std::vector< Part::Geometry * > copies; copies.reserve(geoList.size()); for (std::vector::const_iterator it = geoList.begin(); it != geoList.end(); ++it) { Part::Geometry* copy = (*it)->copy(); - copy->Id = ++id; + GEN_ID(copy); if(construction && copy->getTypeId() != Part::GeomPoint::getClassTypeId()) { copy->Construction = construction; } @@ -724,7 +956,6 @@ int SketchObject::addGeometry(const std::vector &geoList, bool newVals.insert(newVals.end(), copies.begin(), copies.end()); Geometry.setValues(newVals); - LastGeoID.setValue(id); for (std::vector::iterator it = copies.begin(); it != copies.end(); ++it) delete *it; Constraints.acceptGeometry(getCompleteGeometry()); @@ -739,13 +970,12 @@ int SketchObject::addGeometry(const Part::Geometry *geo, bool construction/*=fal std::vector< Part::Geometry * > newVals(vals); Part::Geometry *geoNew = geo->copy(); - geoNew->Id = LastGeoID.getValue()+1; + GEN_ID(geoNew); if(geoNew->getTypeId() != Part::GeomPoint::getClassTypeId()) geoNew->Construction = construction; newVals.push_back(geoNew); - LastGeoID.setValue(geoNew->Id); Geometry.setValues(newVals); Constraints.acceptGeometry(getCompleteGeometry()); delete geoNew; @@ -2327,7 +2557,6 @@ bool SketchObject::isCarbonCopyAllowed(App::Document *pDoc, App::DocumentObject int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, Sketcher::PointPos refPosId/*=Sketcher::none*/) { - auto id = LastGeoID.getValue(); const std::vector< Part::Geometry * > &geovals = getInternalGeometry(); std::vector< Part::Geometry * > newgeoVals(geovals); @@ -2355,7 +2584,7 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, for (std::vector::const_iterator it = geoIdList.begin(); it != geoIdList.end(); ++it) { const Part::Geometry *geo = getGeometry(*it); Part::Geometry *geosym = geo->copy(); - geosym->Id = ++id; + GEN_ID(geosym); // Handle Geometry if(geosym->getTypeId() == Part::GeomLineSegment::getClassTypeId()){ @@ -2616,7 +2845,7 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, for (std::vector::const_iterator it = geoIdList.begin(); it != geoIdList.end(); ++it) { const Part::Geometry *geo = getGeometry(*it); Part::Geometry *geosym = geo->copy(); - geosym->Id = ++id; + GEN_ID(geosym); // Handle Geometry if(geosym->getTypeId() == Part::GeomLineSegment::getClassTypeId()){ @@ -2755,7 +2984,6 @@ int SketchObject::addSymmetric(const std::vector &geoIdList, int refGeoId, // add the geometry Geometry.setValues(newgeoVals); - LastGeoID.setValue(id); Constraints.acceptGeometry(getCompleteGeometry()); rebuildVertexIndex(); @@ -2863,7 +3091,6 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 { const std::vector< Part::Geometry * > &geovals = getInternalGeometry(); std::vector< Part::Geometry * > newgeoVals(geovals); - auto id = LastGeoID.getValue(); const std::vector< Constraint * > &constrvals = this->Constraints.getValues(); std::vector< Constraint * > newconstrVals(constrvals); @@ -2919,7 +3146,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 for (std::vector::const_iterator it = geoIdList.begin(); it != geoIdList.end(); ++it) { const Part::Geometry *geo = getGeometry(*it); Part::Geometry *geocopy = geo->copy(); - geocopy->Id = ++id; + GEN_ID(geocopy); // Handle Geometry if(geocopy->getTypeId() == Part::GeomLineSegment::getClassTypeId()){ @@ -3115,7 +3342,7 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 constrline->setPoints(sp,ep); constrline->Construction=true; - constrline->Id = ++id; + GEN_ID(constrline); newgeoVals.push_back(constrline); Constraint *constNew; @@ -3256,7 +3483,6 @@ int SketchObject::addCopy(const std::vector &geoIdList, const Base::Vector3 } Geometry.setValues(newgeoVals); - LastGeoID.setValue(id); Constraints.acceptGeometry(getCompleteGeometry()); rebuildVertexIndex(); @@ -4195,11 +4421,10 @@ bool SketchObject::convertToNURBS(int GeoId) const std::vector< Part::Geometry * > &vals = getInternalGeometry(); std::vector< Part::Geometry * > newVals(vals); - auto id = LastGeoID.getValue(); if (GeoId < 0) { // external geometry newVals.push_back(bspline); - bspline->Id = ++id; + GEN_ID(bspline); } else { // normal geometry @@ -4223,7 +4448,6 @@ bool SketchObject::convertToNURBS(int GeoId) } Geometry.setValues(newVals); - LastGeoID.setValue(id); Constraints.acceptGeometry(getCompleteGeometry()); rebuildVertexIndex(); @@ -4456,8 +4680,6 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) if (!isCarbonCopyAllowed(pObj->getDocument(), pObj, xinv, yinv)) return -1; - auto id = LastGeoID.getValue(); - SketchObject * psObj = static_cast(pObj); const std::vector< Part::Geometry * > &vals = getInternalGeometry(); @@ -4478,7 +4700,7 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) for (std::vector::const_iterator it=svals.begin(); it != svals.end(); ++it){ Part::Geometry *geoNew = (*it)->copy(); - geoNew->Id = ++id; + GEN_ID(geoNew); if(construction) { geoNew->Construction = true; } @@ -4497,7 +4719,6 @@ int SketchObject::carbonCopy(App::DocumentObject * pObj, bool construction) newcVals.push_back(newConstr); } - LastGeoID.setValue(id); Geometry.setValues(newVals); Constraints.acceptGeometry(getCompleteGeometry()); rebuildVertexIndex(); @@ -5858,8 +6079,28 @@ void SketchObject::Restore(XMLReader &reader) void SketchObject::onChanged(const App::Property* prop) { - if (prop == &Geometry) - geoCached = false; + if (prop == &Geometry) { + geoMap.clear(); + const auto &vals = getInternalGeometry(); + for(long i=0;i<(long)vals.size();++i) { + auto geo = vals[i]; + if(!geo->Id) + geo->Id = ++geoLastId; + else if(geo->Id > geoLastId) + geoLastId = geo->Id; + bool warned = false; + while(!geoMap.insert(std::make_pair(geo->Id,i)).second) { + if(!warned) { + warned = true; + FC_WARN("duplicate geometry id " << geo->Id); + } + geo->Id = ++geoLastId; + } + } + if(LastGeoID.getValue()!=geoLastId) + LastGeoID.setValue(geoLastId); + updateGeoHistory(); + } if (isRestoring() && prop == &Geometry) { std::vector geom = Geometry.getValues(); @@ -5902,13 +6143,6 @@ void SketchObject::onChanged(const App::Property* prop) void SketchObject::onDocumentRestored() { try { - if(!LastGeoID.getValue()) { - const auto &vals = getInternalGeometry(); - int i = 0; - for(;i<(int)vals.size();++i) - vals[i]->Id = i+1; - LastGeoID.setValue(i); - } validateExternalLinks(); rebuildExternalGeometry(); Constraints.acceptGeometry(getCompleteGeometry()); @@ -6285,61 +6519,43 @@ std::string SketchObject::checkSubName(const char *sub) const{ int geoId; const Part::Geometry *geo = 0; - - while(1) { - switch(subname[0]) { - case 'g': { - auto it = geoMap.find(id); - if(it!=geoMap.end()) { - std::ostringstream ss; - geoId = it->second; - geo = getGeometry(geoId); - } - break; - } case 'e': { - auto it = externalGeoMap.find(id); - if(it!=externalGeoMap.end()) { - geoId = -it->second.first; - id = it->second.second; - geo = getGeometry(geoId); - } - break; - }} - if(geo && geo->Id == id) { - char sep; - int posId = none; + switch(subname[0]) { + case 'g': { + auto it = geoMap.find(id); + if(it!=geoMap.end()) { std::ostringstream ss; - if((iss >> sep >> std::hex >> posId) && sep=='v') { - int idx = getVertexIndexGeoPos(geoId,static_cast(posId)); - if(idx < 0) { - FC_ERR("invalid subname " << sub); - return sub; - } - ss << "Vertex" << idx+1; - }else if(geoId>=0) - ss << "Edge" << geoId+1; - else - ss << "ExternalEdge" << (-geoId-3)+1; - return ss.str(); + geoId = it->second; + geo = getGeometry(geoId); } - switch(subname[0]) { - case 'g': { - if(geoCached) { - FC_ERR("cannot find subname " << sub); + break; + } case 'e': { + auto it = externalGeoMap.find(id); + if(it!=externalGeoMap.end()) { + geoId = -it->second.first; + id = it->second.second; + geo = getGeometry(geoId); + } + break; + }} + if(geo && geo->Id == id) { + char sep; + int posId = none; + std::ostringstream ss; + if((iss >> sep >> std::hex >> posId) && sep=='v') { + int idx = getVertexIndexGeoPos(geoId,static_cast(posId)); + if(idx < 0) { + FC_ERR("invalid subname " << sub); return sub; } - geoCached = true; - geoMap.clear(); - int i=0; - for(auto v : getInternalGeometry()) - geoMap[v->Id] = i++; - break; - } case 'e': - // external geo map is generated in rebuildExternalGeometry() - FC_ERR("cannot find subname " << sub); - return sub; - } + ss << "Vertex" << idx+1; + }else if(geoId>=0) + ss << "Edge" << geoId+1; + else + ss << "ExternalEdge" << (-geoId-3)+1; + return ss.str(); } + FC_ERR("cannot find subname " << sub); + return sub; } bool SketchObject::geoIdFromShapeType(const char *shapetype, int &geoId, PointPos &posId) const { diff --git a/src/Mod/Sketcher/App/SketchObject.h b/src/Mod/Sketcher/App/SketchObject.h index 8aa607c26b8e..86ba7bdcdf05 100644 --- a/src/Mod/Sketcher/App/SketchObject.h +++ b/src/Mod/Sketcher/App/SketchObject.h @@ -182,6 +182,7 @@ class SketcherExport SketchObject : public Part::Part2DObject int movePoint(int GeoId, PointPos PosId, const Base::Vector3d& toPoint, bool relative=false, bool updateGeoBeforeMoving=false); /// retrieves the coordinates of a point Base::Vector3d getPoint(int GeoId, PointPos PosId) const; + static Base::Vector3d getPoint(const Part::Geometry *geo, PointPos PosId); /// toggle geometry to draft line int toggleConstruction(int GeoId); @@ -364,8 +365,13 @@ class SketcherExport SketchObject : public Part::Part2DObject { return convertSubName(subname.c_str()); } std::vector > getPointRefs(const char *subname); + void setGeoHistoryLevel(int level); + int getGeoHistoryLevel() const {return geoHistoryLevel;} + protected: + void generateExternalId(const char *); + /// get called by the container when a property has changed virtual void onChanged(const App::Property* /*prop*/); virtual void onDocumentRestored(); @@ -383,6 +389,9 @@ class SketcherExport SketchObject : public Part::Part2DObject */ std::vector supportedGeometry(const std::vector &geoList) const; + void updateGeoHistory(); + void generateId(Part::Geometry *geo); + private: /// Flag to allow external geometry from other bodies than the one this sketch belongs to bool allowOtherBody; @@ -416,10 +425,16 @@ class SketcherExport SketchObject : public Part::Part2DObject bool AutoLockTangencyAndPerpty(Constraint* cstr, bool bForce = false, bool bLock = true); - mutable std::vector externalGeoKeys; - mutable std::map > externalGeoMap; - mutable std::map geoMap; - mutable bool geoCached; + std::vector externalGeoKeys; + std::map > externalGeoMap; + std::map geoMap; + + int geoHistoryLevel; + std::vector geoIdHistory; + long geoLastId; + + class GeoHistory; + std::unique_ptr geoHistory; }; typedef App::FeaturePythonT SketchObjectPython; diff --git a/src/Mod/Sketcher/App/boost_fix/container/detail/memory_util.hpp b/src/Mod/Sketcher/App/boost_fix/container/detail/memory_util.hpp new file mode 100644 index 000000000000..609536dcde35 --- /dev/null +++ b/src/Mod/Sketcher/App/boost_fix/container/detail/memory_util.hpp @@ -0,0 +1,83 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP + +#if defined(_MSC_VER) +# pragma once +#endif + +#include +#include +#include +#include "../../intrusive/detail/has_member_function_callable_with.hpp" + + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 2, "../../intrusive/detail/has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 3, "../../intrusive/detail/has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME max_size +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, "../../intrusive/detail/has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME select_on_container_copy_construction +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, "../../intrusive/detail/has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS+1, "../../intrusive/detail/has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME swap +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, "../../intrusive/detail/has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace container { +namespace container_detail { + + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#include + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP) diff --git a/src/Mod/Sketcher/App/boost_fix/intrusive/detail/has_member_function_callable_with.hpp b/src/Mod/Sketcher/App/boost_fix/intrusive/detail/has_member_function_callable_with.hpp new file mode 100644 index 000000000000..f118a2a36955 --- /dev/null +++ b/src/Mod/Sketcher/App/boost_fix/intrusive/detail/has_member_function_callable_with.hpp @@ -0,0 +1,365 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +// sample.h + +#if !defined(BOOST_PP_IS_ITERATING) + + #ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + + #include + #include + #include + #include + #include + #include + + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //wrong SFINAE for GCC 4.2/4.3 + #if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430) + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED + #elif defined(BOOST_INTEL) && (BOOST_INTEL < 1200 ) + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED + #endif + + namespace boost_intrusive_has_member_function_callable_with { + + struct dont_care + { + dont_care(...); + }; + + struct private_type + { + static private_type p; + private_type const &operator,(int) const; + }; + + typedef char yes_type; // sizeof(yes_type) == 1 + struct no_type{ char dummy[2]; }; // sizeof(no_type) == 2 + + template + no_type is_private_type(T const &); + yes_type is_private_type(private_type const &); + + } //boost_intrusive_has_member_function_callable_with + + #include + + #endif //BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + +#else //!BOOST_PP_IS_ITERATING + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME not defined!" + #endif + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN not defined!" + #endif + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END not defined!" + #endif + + #if BOOST_PP_ITERATION_START() != 0 + #error "BOOST_PP_ITERATION_START() must be zero (0)" + #endif + + #if BOOST_PP_ITERATION() == 0 + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template + class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + struct BaseMixin + { + void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); + }; + + struct Base : public ::boost::intrusive::detail::remove_cv::type, public BaseMixin { Base(); }; + template class Helper{}; + + template + static boost_intrusive_has_member_function_callable_with::no_type deduce + (U*, Helper* = 0); + static boost_intrusive_has_member_function_callable_with::yes_type deduce(...); + + public: + static const bool value = + sizeof(boost_intrusive_has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0))); + }; + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl); + //! + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + + { + static const bool value = false; + }; + //! + + #if !defined(_MSC_VER) || (_MSC_VER < 1600) + + #if defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + + { + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //wrong SFINAE for GCC 4.2/4.3 + static const bool value = true; + }; + + #else //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + //Special case for 0 args + template< class F + , std::size_t N = + sizeof((boost::move_detail::declval(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::yes_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not + //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. + template + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::no_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + + { + template + static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); + + template + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test< Fun >(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + #endif //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600) + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + + { + template + static decltype( boost::move_detail::declval().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() + , boost_intrusive_has_member_function_callable_with::yes_type()) + Test(Fun*); + + template + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600) + + #else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl); + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + + { + static const bool value = false; + }; + + //Special case for 0 args + template< class F + , std::size_t N = + sizeof((boost::move_detail::declval(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::yes_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not + //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. + template + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::no_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + template + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + + { + #ifdef BOOST_MSVC + template + static decltype( boost::move_detail::declval().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() + , boost_intrusive_has_member_function_callable_with::yes_type()) + Test(Fun*); + #else + template + static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)*); + #endif + + + template + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test< Fun >(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + + template + struct BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) + : Fun + { + BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )(); + using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; + + boost_intrusive_has_member_function_callable_with::private_type + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( DontCares...) const; + }; + + template + struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + + { + template + struct make_dontcare + { + typedef boost_intrusive_has_member_function_callable_with::dont_care type; + }; + + typedef BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) + ::type...> FunWrap; + + static bool const value = (sizeof(boost_intrusive_has_member_function_callable_with::no_type) == + sizeof(boost_intrusive_has_member_function_callable_with::is_private_type + ( (::boost::move_detail::declval< FunWrap >(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( ::boost::move_detail::declval()... ), 0) ) + ) + ); + }; + + template + struct BOOST_PP_CAT( has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + : public BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + < Fun + , BOOST_PP_CAT( has_member_function_named_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )::value + , Args... > + {}; + + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #else //BOOST_PP_ITERATION() == 0 + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template + struct BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)) + : Fun + { + BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))(); + + using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; + boost_intrusive_has_member_function_callable_with::private_type + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( BOOST_PP_ENUM(BOOST_PP_ITERATION() + , BOOST_INTRUSIVE_PP_IDENTITY + , boost_intrusive_has_member_function_callable_with::dont_care)) const; + }; + + template + struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + + { + typedef BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)) + FunWrap; + static bool const value = + (sizeof(boost_intrusive_has_member_function_callable_with::no_type) == + sizeof(boost_intrusive_has_member_function_callable_with::is_private_type + ( (boost::move_detail::declval(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( BOOST_PP_ENUM( BOOST_PP_ITERATION(), BOOST_INTRUSIVE_PP_DECLVAL, _) ), 0 + ) + ) + ) + ); + }; + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + #endif //BOOST_PP_ITERATION() == 0 + + #if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH() + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template + struct BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + : public BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + ::value + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P) > + {}; + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #endif //#if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH() + +#endif //!BOOST_PP_IS_ITERATING diff --git a/src/Mod/Sketcher/App/boost_fix/intrusive/detail/memory_util.hpp b/src/Mod/Sketcher/App/boost_fix/intrusive/detail/memory_util.hpp new file mode 100644 index 000000000000..a2a48dcd875e --- /dev/null +++ b/src/Mod/Sketcher/App/boost_fix/intrusive/detail/memory_util.hpp @@ -0,0 +1,292 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2013. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include +#include +#include +#include + +namespace boost { +namespace intrusive { +namespace detail { + +template +inline T* addressof(T& obj) +{ + return static_cast + (static_cast + (const_cast + (&reinterpret_cast(obj)) + ) + ); +} + +template struct unvoid { typedef T type; }; +template <> struct unvoid { struct type { }; }; +template <> struct unvoid { struct type { }; }; + +template struct unvoid_ref { typedef T &type; }; +template <> struct unvoid_ref { struct type_impl { }; typedef type_impl & type; }; +template <> struct unvoid_ref { struct type_impl { }; typedef type_impl & type; }; + +template +struct LowPriorityConversion +{ + // Convertible from T with user-defined-conversion rank. + LowPriorityConversion(const T&) { } +}; + +// Infrastructure for providing a default type for T::TNAME if absent. +#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \ + template \ + struct boost_intrusive_default_type_ ## TNAME \ + { \ + template \ + static char test(int, typename X::TNAME*); \ + \ + template \ + static int test(boost::intrusive::detail:: \ + LowPriorityConversion, void*); \ + \ + struct DefaultWrap { typedef DefaultType TNAME; }; \ + \ + static const bool value = (1 == sizeof(test(0, 0))); \ + \ + typedef typename \ + ::boost::intrusive::detail::if_c \ + ::type::TNAME type; \ + }; \ + \ + template \ + struct boost_intrusive_eval_default_type_ ## TNAME \ + { \ + template \ + static char test(int, typename X::TNAME*); \ + \ + template \ + static int test(boost::intrusive::detail:: \ + LowPriorityConversion, void*); \ + \ + struct DefaultWrap \ + { typedef typename DefaultType::type TNAME; }; \ + \ + static const bool value = (1 == sizeof(test(0, 0))); \ + \ + typedef typename \ + ::boost::intrusive::detail::eval_if_c \ + < value \ + , ::boost::intrusive::detail::identity \ + , ::boost::intrusive::detail::identity \ + >::type::TNAME type; \ + }; \ +// + +#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ + typename INSTANTIATION_NS_PREFIX \ + boost_intrusive_default_type_ ## TNAME< T, TIMPL >::type \ +// + +#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ + typename INSTANTIATION_NS_PREFIX \ + boost_intrusive_eval_default_type_ ## TNAME< T, TIMPL >::type \ +// + +}}} //namespace boost::intrusive::detail + +#include "has_member_function_callable_with.hpp" + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME pointer_to +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, "has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME static_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, "has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME const_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, "has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME dynamic_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, "has_member_function_callable_with.hpp")) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace intrusive { +namespace detail { + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(element_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +////////////////////// +//struct first_param +////////////////////// + +template struct first_param +{ typedef void type; }; + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template