This commit is contained in:
Laurent Perron
2021-11-28 13:00:27 +01:00
parent 92137693d4
commit 73d3873cb5
5 changed files with 6 additions and 18 deletions

View File

@@ -13,19 +13,17 @@
// This file contains string processing functions related to
// uppercase, lowercase, etc.
#include "ortools/base/case.h"
#include <functional>
#include <string>
//#include "base/port.h"
#include "absl/hash/hash.h"
#include "absl/strings/ascii.h"
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
#ifdef _MSC_VER
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
@@ -101,7 +99,7 @@ int AsciiCaseInsensitiveCompare(absl::string_view s1, absl::string_view s2) {
}
size_t AsciiCaseInsensitiveHash::operator()(absl::string_view s) const {
//return absl::HashOf(absl::AsciiStrToLower(s));
// return absl::HashOf(absl::AsciiStrToLower(s));
return std::hash<std::string>{}(absl::AsciiStrToLower(s));
}
@@ -113,7 +111,7 @@ bool AsciiCaseInsensitiveEq::operator()(absl::string_view s1,
void MakeAsciiTitlecase(std::string* s, absl::string_view delimiters) {
bool upper = true;
for (auto &ch : *s) {
for (auto& ch : *s) {
if (upper) {
ch = absl::ascii_toupper(ch);
}
@@ -127,5 +125,4 @@ std::string MakeAsciiTitlecase(absl::string_view s,
MakeAsciiTitlecase(&result, delimiters);
return result;
}
} // namespace strings

View File

@@ -18,8 +18,6 @@
// Unlike <ctype.h> (or absl/strings/ascii.h), the functions in this file
// are designed to operate on strings, not single characters.
//
// If you need to process UTF8 strings, take a look at files in i18n/utf8.
//
// Except for those marked as "using the C/POSIX locale", these functions are
// for ASCII strings only.
@@ -43,7 +41,6 @@
#include "absl/strings/string_view.h"
namespace strings {
// Enum values returned by GetAsciiCapitalization().
enum class AsciiCapitalizationType {
kLower, // Entirely lowercase
@@ -128,5 +125,4 @@ std::string MakeAsciiTitlecase(absl::string_view s,
absl::string_view delimiters);
} // namespace strings
#endif // OR_TOOLS_BASE_CASE_H_

View File

@@ -40,6 +40,7 @@
#include <string>
#include <type_traits>
#include "absl/base/port.h"
#include "ortools/base/integral_types.h"
namespace gtl {

View File

@@ -151,6 +151,7 @@
#include <ostream> // NOLINT
#include <type_traits>
#include "absl/base/port.h"
#include "absl/strings/string_view.h"
#include "ortools/base/macros.h"

View File

@@ -11,11 +11,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include <cstring>
#include <ctime>
#include <random>
#include "ortools/base/random.h"
namespace operations_research {
@@ -34,9 +29,7 @@ uint64_t ACMRandom::operator()(uint64_t val_max) {
return val_max == 0 ? 0 : Next64() % val_max;
}
int32_t ACMRandom::HostnamePidTimeSeed() {
return std::random_device{}();
}
int32_t ACMRandom::HostnamePidTimeSeed() { return std::random_device{}(); }
int32_t ACMRandom::DeterministicSeed() { return 0; }