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

Side by Side Diff: mojo/edk/util/make_unique.h

Issue 1558333002: Rectify our use of std::nullptr_t, inclusions of <stddef.h>/<cstddef>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 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 | « mojo/edk/util/command_line.h ('k') | mojo/edk/util/ref_counted.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 // This is almost the source from N3656 ("make_unique (Revision 1)"; 5 // This is almost the source from N3656 ("make_unique (Revision 1)";
6 // https://isocpp.org/files/papers/N3656.txt) almost verbatim, so that we have a 6 // https://isocpp.org/files/papers/N3656.txt) almost verbatim, so that we have a
7 // "make_unique" to use until we can use C++14. The following changes have been 7 // "make_unique" to use until we can use C++14. The following changes have been
8 // made: 8 // made:
9 // - It's called |MakeUnique| instead of |make_unique|. 9 // - It's called |MakeUnique| instead of |make_unique|.
10 // - It's in the |mojo::util| namespace instead of |std|; this also 10 // - It's in the |mojo::util| namespace instead of |std|; this also
11 // necessitates adding some |std::|s. 11 // necessitates adding some |std::|s.
12 // - It's been formatted. 12 // - It's been formatted.
13 13
14 #ifndef MOJO_EDK_UTIL_MAKE_UNIQUE_H_ 14 #ifndef MOJO_EDK_UTIL_MAKE_UNIQUE_H_
15 #define MOJO_EDK_UTIL_MAKE_UNIQUE_H_ 15 #define MOJO_EDK_UTIL_MAKE_UNIQUE_H_
16 16
17 #include <cstddef> 17 #include <stddef.h>
18
18 #include <memory> 19 #include <memory>
19 #include <type_traits> 20 #include <type_traits>
20 #include <utility> 21 #include <utility>
21 22
22 namespace mojo { 23 namespace mojo {
23 namespace util { 24 namespace util {
24 25
25 template <class T> 26 template <class T>
26 struct _Unique_if { 27 struct _Unique_if {
27 typedef std::unique_ptr<T> _Single_object; 28 typedef std::unique_ptr<T> _Single_object;
(...skipping 20 matching lines...) Expand all
48 return std::unique_ptr<T>(new U[n]()); 49 return std::unique_ptr<T>(new U[n]());
49 } 50 }
50 51
51 template <class T, class... Args> 52 template <class T, class... Args>
52 typename _Unique_if<T>::_Known_bound MakeUnique(Args&&...) = delete; 53 typename _Unique_if<T>::_Known_bound MakeUnique(Args&&...) = delete;
53 54
54 } // namespace util 55 } // namespace util
55 } // namespace mojo 56 } // namespace mojo
56 57
57 #endif // MOJO_EDK_UTIL_MAKE_UNIQUE_H_ 58 #endif // MOJO_EDK_UTIL_MAKE_UNIQUE_H_
OLDNEW
« no previous file with comments | « mojo/edk/util/command_line.h ('k') | mojo/edk/util/ref_counted.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698