small code update/sync

This commit is contained in:
Laurent Perron
2023-01-25 18:35:46 +01:00
parent 2be08a70e7
commit 46f3f1bd79
3 changed files with 6 additions and 5 deletions

View File

@@ -18,17 +18,18 @@
#include <string>
#include "absl/strings/numbers.h"
#include "absl/strings/string_view.h"
#include "ortools/base/logging.h"
namespace operations_research {
int32_t strtoint32(const std::string& word) {
int32_t strtoint32(absl::string_view word) {
int result;
CHECK(absl::SimpleAtoi(word, &result));
return result;
}
int64_t strtoint64(const std::string& word) {
int64_t strtoint64(absl::string_view word) {
int64_t result;
CHECK(absl::SimpleAtoi(word, &result));
return result;

View File

@@ -45,12 +45,13 @@
#include <string>
#include "absl/base/port.h" // disable some warnings on Windows
#include "absl/strings/string_view.h"
#include "ortools/base/integral_types.h"
namespace operations_research {
int32_t strtoint32(const std::string& word);
int64_t strtoint64(const std::string& word);
int32_t strtoint32(absl::string_view word);
int64_t strtoint64(absl::string_view word);
// Convenience versions of the above that take a string argument.
inline int32_t atoi32(const std::string& word) { return strtoint32(word); }

View File

@@ -51,7 +51,6 @@
#include "absl/meta/type_traits.h"
#include "ortools/base/logging.h"
#include "ortools/base/map_util.h"
#include "ortools/base/ptr_util.h"
namespace util {
// Generic version of GetConnectedComponents() (see below) that supports other