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

Side by Side Diff: base/files/file_path.h

Issue 612323010: Align base::hash_map with C++11. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try a different tack for C++ insanity Created 6 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // FilePath is a container for pathnames stored in a platform's native string 5 // FilePath is a container for pathnames stored in a platform's native string
6 // type, providing containers for manipulation in according with the 6 // type, providing containers for manipulation in according with the
7 // platform's conventions for pathnames. It supports the following path 7 // platform's conventions for pathnames. It supports the following path
8 // types: 8 // types:
9 // 9 //
10 // POSIX Windows 10 // POSIX Windows
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 #define PRFilePathLiteral "%s" 446 #define PRFilePathLiteral "%s"
447 #elif defined(OS_WIN) 447 #elif defined(OS_WIN)
448 #define FILE_PATH_LITERAL(x) L ## x 448 #define FILE_PATH_LITERAL(x) L ## x
449 #define PRFilePath "ls" 449 #define PRFilePath "ls"
450 #define PRFilePathLiteral L"%ls" 450 #define PRFilePathLiteral L"%ls"
451 #endif // OS_WIN 451 #endif // OS_WIN
452 452
453 // Provide a hash function so that hash_sets and maps can contain FilePath 453 // Provide a hash function so that hash_sets and maps can contain FilePath
454 // objects. 454 // objects.
455 namespace BASE_HASH_NAMESPACE { 455 namespace BASE_HASH_NAMESPACE {
456 #if defined(COMPILER_GCC)
457 456
458 template<> 457 template<>
459 struct hash<base::FilePath> { 458 struct hash<base::FilePath> {
460 size_t operator()(const base::FilePath& f) const { 459 size_t operator()(const base::FilePath& f) const {
461 return hash<base::FilePath::StringType>()(f.value()); 460 return hash<base::FilePath::StringType>()(f.value());
462 } 461 }
463 }; 462 };
464 463
465 #elif defined(COMPILER_MSVC)
466
467 inline size_t hash_value(const base::FilePath& f) {
468 return hash_value(f.value());
469 }
470
471 #endif // COMPILER
472
473 } // namespace BASE_HASH_NAMESPACE 464 } // namespace BASE_HASH_NAMESPACE
474 465
475 #endif // BASE_FILES_FILE_PATH_H_ 466 #endif // BASE_FILES_FILE_PATH_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698