diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,10 +18,11 @@ FIND_PACKAGE(COIN) IF(MSVC) - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4503 /wd4800 /wd4996") # Suppressed warnings: # C4250: 'class1' : inherits 'class2::member' via dominance # C4355: 'this' : used in base member initializer list +# C4503: 'function' : decorated name length exceeded, name was truncated # C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning) # C4996: 'function': was declared deprecated ENDIF(MSVC) diff --git a/lemon/Makefile.am b/lemon/Makefile.am --- a/lemon/Makefile.am +++ b/lemon/Makefile.am @@ -1,6 +1,7 @@ EXTRA_DIST += \ lemon/lemon.pc.in \ - lemon/CMakeLists.txt + lemon/CMakeLists.txt \ + lemon/config.h.cmake pkgconfig_DATA += lemon/lemon.pc @@ -16,7 +17,7 @@ lemon/bits/windows.cc nodist_lemon_HEADERS = lemon/config.h - + lemon_libemon_la_CXXFLAGS = \ $(AM_CXXFLAGS) \ $(GLPK_CFLAGS) \ diff --git a/lemon/concepts/graph_components.h b/lemon/concepts/graph_components.h --- a/lemon/concepts/graph_components.h +++ b/lemon/concepts/graph_components.h @@ -71,6 +71,11 @@ /// Assignment operator for the item. GraphItem& operator=(const GraphItem&) { return *this; } + /// \brief Assignment operator for INVALID. + /// + /// This operator makes the item invalid. + GraphItem& operator=(Invalid) { return *this; } + /// \brief Equality operator. /// /// Equality operator. @@ -96,6 +101,7 @@ struct Constraints { void constraints() { _GraphItem i1; + i1=INVALID; _GraphItem i2 = i1; _GraphItem i3 = INVALID; @@ -221,14 +227,7 @@ /// Besides the core graph item functionality each arc should /// be convertible to the represented edge. Edge(const Arc&) {} - - /// \brief Assign an arc to an edge. - /// - /// This function assigns an arc to an edge. - /// Besides the core graph item functionality each arc should - /// be convertible to the represented edge. - Edge& operator=(const Arc&) { return *this; } - }; + }; /// \brief Return one end node of an edge. /// @@ -353,10 +352,12 @@ void constraints() { checkConcept(); typename _Digraph::Node node; + node=INVALID; int nid = digraph.id(node); nid = digraph.id(node); node = digraph.nodeFromId(nid); typename _Digraph::Arc arc; + arc=INVALID; int eid = digraph.id(arc); eid = digraph.id(arc); arc = digraph.arcFromId(eid); diff --git a/lemon/edge_set.h b/lemon/edge_set.h --- a/lemon/edge_set.h +++ b/lemon/edge_set.h @@ -84,6 +84,12 @@ ListArcSetBase() : first_arc(-1), first_free_arc(-1) {} + Node addNode() { + LEMON_ASSERT(false, + "This graph structure does not support node insertion"); + return INVALID; // avoid warning + } + Arc addArc(const Node& u, const Node& v) { int n; if (first_free_arc == -1) { @@ -416,6 +422,12 @@ ListEdgeSetBase() : first_arc(-1), first_free_arc(-1) {} + Node addNode() { + LEMON_ASSERT(false, + "This graph structure does not support node insertion"); + return INVALID; // avoid warning + } + Edge addEdge(const Node& u, const Node& v) { int n; @@ -816,6 +828,12 @@ SmartArcSetBase() {} + Node addNode() { + LEMON_ASSERT(false, + "This graph structure does not support node insertion"); + return INVALID; // avoid warning + } + Arc addArc(const Node& u, const Node& v) { int n = arcs.size(); arcs.push_back(ArcT()); @@ -1112,6 +1130,12 @@ SmartEdgeSetBase() {} + Node addNode() { + LEMON_ASSERT(false, + "This graph structure does not support node insertion"); + return INVALID; // avoid warning + } + Edge addEdge(const Node& u, const Node& v) { int n = arcs.size(); arcs.push_back(ArcT()); diff --git a/test/min_cost_flow_test.cc b/test/min_cost_flow_test.cc --- a/test/min_cost_flow_test.cc +++ b/test/min_cost_flow_test.cc @@ -93,22 +93,24 @@ struct Constraints { void constraints() { checkConcept(); + + const Constraints& me = *this; - MCF mcf(g); + MCF mcf(me.g); const MCF& const_mcf = mcf; b = mcf.reset() - .lowerMap(lower) - .upperMap(upper) - .costMap(cost) - .supplyMap(sup) - .stSupply(n, n, k) + .lowerMap(me.lower) + .upperMap(me.upper) + .costMap(me.cost) + .supplyMap(me.sup) + .stSupply(me.n, me.n, me.k) .run(); c = const_mcf.totalCost(); x = const_mcf.template totalCost(); - v = const_mcf.flow(a); - c = const_mcf.potential(n); + v = const_mcf.flow(me.a); + c = const_mcf.potential(me.n); const_mcf.flowMap(fm); const_mcf.potentialMap(pm); } @@ -120,15 +122,16 @@ typedef concepts::ReadMap CAM; typedef concepts::WriteMap FlowMap; typedef concepts::WriteMap PotMap; + + GR g; + VAM lower; + VAM upper; + CAM cost; + NM sup; + Node n; + Arc a; + Value k; - const GR &g; - const VAM &lower; - const VAM &upper; - const CAM &cost; - const NM ⊃ - const Node &n; - const Arc &a; - const Value &k; FlowMap fm; PotMap pm; bool b;