spans
This commit is contained in:
@@ -273,6 +273,7 @@ cc_test(
|
||||
"//ortools/util:file_util",
|
||||
"@com_google_absl//absl/random",
|
||||
"@com_google_absl//absl/strings:str_format",
|
||||
"@com_google_absl//absl/types:span",
|
||||
"@com_google_benchmark//:benchmark",
|
||||
"@com_google_protobuf//:protobuf",
|
||||
],
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "absl/container/flat_hash_map.h"
|
||||
#include "absl/random/distributions.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ortools/base/gmock.h"
|
||||
#include "ortools/graph/bounded_dijkstra.h"
|
||||
@@ -154,7 +155,7 @@ TEST(BidirectionalDijkstraTest, RandomizedCorrectnessTest) {
|
||||
return out;
|
||||
};
|
||||
auto print_node_distances =
|
||||
[&](const std::vector<Dijkstra::NodeDistance>& nds) -> std::string {
|
||||
[&](absl::Span<const Dijkstra::NodeDistance> nds) -> std::string {
|
||||
std::string out = "{";
|
||||
for (const Dijkstra::NodeDistance& nd : nds) {
|
||||
absl::StrAppend(&out, " #", nd.node, " dist=", (nd.distance), ",");
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ortools/base/logging.h"
|
||||
@@ -30,7 +31,7 @@
|
||||
namespace operations_research {
|
||||
|
||||
// Displays the path.
|
||||
std::string PathToString(const std::vector<int>& path) {
|
||||
std::string PathToString(absl::Span<const int> path) {
|
||||
std::string path_string;
|
||||
const int size = path.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "absl/functional/bind_front.h"
|
||||
#include "absl/random/distributions.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ortools/base/mathutil.h"
|
||||
@@ -76,7 +77,7 @@ class CliqueSizeVerifier {
|
||||
|
||||
int64_t num_cliques() const { return num_cliques_; }
|
||||
|
||||
bool AppendClique(const std::vector<int>& new_clique) {
|
||||
bool AppendClique(absl::Span<const int> new_clique) {
|
||||
EXPECT_GE(expected_max_clique_size_, new_clique.size());
|
||||
EXPECT_LE(expected_min_clique_size_, new_clique.size());
|
||||
++num_cliques_;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
|
||||
#include "absl/random/random.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
#include "absl/types/span.h"
|
||||
#include "benchmark/benchmark.h"
|
||||
#include "google/protobuf/text_format.h"
|
||||
#include "gtest/gtest.h"
|
||||
@@ -485,7 +486,7 @@ void GenerateRandomArcValuations(const Graph& graph, const int64_t max_range,
|
||||
}
|
||||
|
||||
template <typename Graph>
|
||||
void SetUpNetworkData(const std::vector<int64_t>& arc_capacity,
|
||||
void SetUpNetworkData(absl::Span<const int64_t> arc_capacity,
|
||||
GenericMaxFlow<Graph>* max_flow) {
|
||||
const Graph* graph = max_flow->graph();
|
||||
for (typename Graph::ArcIndex arc = 0; arc < graph->num_arcs(); ++arc) {
|
||||
|
||||
Reference in New Issue
Block a user