Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: third_party/libaddressinput/chromium/string_compare.cc

Issue 2733283002: Require explicit selection of traits for LazyInstance (Closed)
Patch Set: l10n again Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "third_party/libaddressinput/src/cpp/src/util/string_compare.h" 5 #include "third_party/libaddressinput/src/cpp/src/util/string_compare.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 23 matching lines...) Expand all
34 DCHECK(U_SUCCESS(error_code)); 34 DCHECK(U_SUCCESS(error_code));
35 return result; 35 return result;
36 } 36 }
37 37
38 private: 38 private:
39 std::unique_ptr<icu::Collator> collator_; 39 std::unique_ptr<icu::Collator> collator_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(IcuStringComparer); 41 DISALLOW_COPY_AND_ASSIGN(IcuStringComparer);
42 }; 42 };
43 43
44 static base::LazyInstance<IcuStringComparer> g_comparer = 44 static base::LazyInstance<IcuStringComparer>::DestructorAtExit g_comparer =
45 LAZY_INSTANCE_INITIALIZER; 45 LAZY_INSTANCE_INITIALIZER;
46 46
47 } // namespace 47 } // namespace
48 48
49 // Dummy required for std::unique_ptr<Impl>. 49 // Dummy required for std::unique_ptr<Impl>.
50 class StringCompare::Impl {}; 50 class StringCompare::Impl {};
51 51
52 StringCompare::StringCompare() {} 52 StringCompare::StringCompare() {}
53 53
54 StringCompare::~StringCompare() {} 54 StringCompare::~StringCompare() {}
55 55
56 bool StringCompare::NaturalEquals(const std::string& a, 56 bool StringCompare::NaturalEquals(const std::string& a,
57 const std::string& b) const { 57 const std::string& b) const {
58 return g_comparer.Get().Compare(a, b) == 0; 58 return g_comparer.Get().Compare(a, b) == 0;
59 } 59 }
60 60
61 bool StringCompare::NaturalLess(const std::string& a, 61 bool StringCompare::NaturalLess(const std::string& a,
62 const std::string& b) const { 62 const std::string& b) const {
63 return g_comparer.Get().Compare(a, b) < 0; 63 return g_comparer.Get().Compare(a, b) < 0;
64 } 64 }
65 65
66 } // namespace addressinput 66 } // namespace addressinput
67 } // namespace i18n 67 } // namespace i18n
OLDNEW
« no previous file with comments | « storage/browser/fileapi/isolated_context.h ('k') | tools/json_schema_compiler/cpp_bundle_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698