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

Side by Side Diff: base/optional.h

Issue 1811163002: Share link header parsing code between blink and content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base-optional
Patch Set: Created 4 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
« no previous file with comments | « no previous file | components/BUILD.gn » ('j') | components/link_header_util/link_header_util.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef BASE_OPTIONAL_H_ 5 #ifndef BASE_OPTIONAL_H_
6 #define BASE_OPTIONAL_H_ 6 #define BASE_OPTIONAL_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/aligned_memory.h" 9 #include "base/memory/aligned_memory.h"
10 10
11 namespace base { 11 namespace base {
12 12
13 // Specification: 13 // Specification:
14 // http://en.cppreference.com/w/cpp/experimental/optional/in_place_t 14 // http://en.cppreference.com/w/cpp/experimental/optional/in_place_t
15 struct in_place_t {}; 15 struct in_place_t {};
16 16
17 // Specification: 17 // Specification:
18 // http://en.cppreference.com/w/cpp/experimental/optional/nullopt_t 18 // http://en.cppreference.com/w/cpp/experimental/optional/nullopt_t
19 struct nullopt_t { 19 struct nullopt_t {
20 explicit nullopt_t(int) { } 20 explicit nullopt_t(int) { }
21 }; 21 };
22 22
23 // Specification: 23 // Specification:
24 // http://en.cppreference.com/w/cpp/experimental/optional/in_place 24 // http://en.cppreference.com/w/cpp/experimental/optional/in_place
25 const in_place_t in_place{}; 25 const in_place_t in_place{};
26 26
27 // Specification: 27 // Specification:
28 // http://en.cppreference.com/w/cpp/experimental/optional/nullopt 28 // http://en.cppreference.com/w/cpp/experimental/optional/nullopt
29 const nullopt_t nullopt(0); 29 // const nullopt_t nullopt(0);
Yoav Weiss 2016/03/29 22:05:45 should be deleted?
Marijn Kruisselbrink 2016/04/20 01:45:03 This was an artifact of me basing this CL on a ver
30 30
31 // base::Optional is a Chromium version of the C++ library experimental optional 31 // base::Optional is a Chromium version of the C++ library experimental optional
32 // class: http://en.cppreference.com/w/cpp/experimental/optional/optional 32 // class: http://en.cppreference.com/w/cpp/experimental/optional/optional
33 // The following known differences apply: 33 // The following known differences apply:
34 // - 'constexpr' is not used because it is currently banned from Chromium. 34 // - 'constexpr' is not used because it is currently banned from Chromium.
35 // - The constructor and emplace method using initializer_list are not 35 // - The constructor and emplace method using initializer_list are not
36 // implemented because 'initializer_list' is banned from Chromium. 36 // implemented because 'initializer_list' is banned from Chromium.
37 // - No exceptions are thrown, because they are banned from Chromium. 37 // - No exceptions are thrown, because they are banned from Chromium.
38 // - Private member |val| (for exposition) is not implemented. 38 // - Private member |val| (for exposition) is not implemented.
39 // - The destructor doesn't use std::std::is_trivially_destructible. 39 // - The destructor doesn't use std::std::is_trivially_destructible.
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 template <class T> 412 template <class T>
413 void swap(Optional<T>& lhs, Optional<T>& rhs) { 413 void swap(Optional<T>& lhs, Optional<T>& rhs) {
414 lhs.swap(rhs); 414 lhs.swap(rhs);
415 } 415 }
416 416
417 // TODO: implement hash function. 417 // TODO: implement hash function.
418 418
419 } // namespace base 419 } // namespace base
420 420
421 #endif // BASE_OPTIONAL_H_ 421 #endif // BASE_OPTIONAL_H_
OLDNEW
« no previous file with comments | « no previous file | components/BUILD.gn » ('j') | components/link_header_util/link_header_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698