File tree Expand file tree Collapse file tree 4 files changed +38
-8
lines changed
utils/bazel/llvm-project-overlay/libc Expand file tree Collapse file tree 4 files changed +38
-8
lines changed Original file line number Diff line number Diff line change 16
16
namespace __llvm_libc {
17
17
namespace cpp {
18
18
19
- // Trivial in_place_t struct.
20
- struct in_place_t {
21
- LIBC_INLINE constexpr explicit in_place_t () = default;
22
- };
23
-
24
19
// Trivial nullopt_t struct.
25
20
struct nullopt_t {
26
21
LIBC_INLINE constexpr explicit nullopt_t () = default;
@@ -29,9 +24,6 @@ struct nullopt_t {
29
24
// nullopt that can be used and returned.
30
25
LIBC_INLINE_VAR constexpr nullopt_t nullopt{};
31
26
32
- // in_place that can be used in the constructor.
33
- LIBC_INLINE_VAR constexpr in_place_t in_place{};
34
-
35
27
// This is very simple implementation of the std::optional class. It makes
36
28
// several assumptions that the underlying type is trivially constructable,
37
29
// copyable, or movable.
Original file line number Diff line number Diff line change 11
11
12
12
#include " src/__support/CPP/utility/declval.h"
13
13
#include " src/__support/CPP/utility/forward.h"
14
+ #include " src/__support/CPP/utility/in_place.h"
14
15
#include " src/__support/CPP/utility/integer_sequence.h"
15
16
#include " src/__support/CPP/utility/move.h"
16
17
Original file line number Diff line number Diff line change
1
+ // ===-- in_place utility ----------------------------------------*- C++ -*-===//
2
+ //
3
+ // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
+ // See https://llvm.org/LICENSE.txt for license information.
5
+ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
+ //
7
+ // ===----------------------------------------------------------------------===//
8
+ #ifndef LLVM_LIBC_SRC_SUPPORT_CPP_UTILITY_IN_PLACE_H
9
+ #define LLVM_LIBC_SRC_SUPPORT_CPP_UTILITY_IN_PLACE_H
10
+
11
+ #include " src/__support/macros/attributes.h"
12
+
13
+ #include < stddef.h> // size_t
14
+
15
+ namespace __llvm_libc ::cpp {
16
+
17
+ // in_place
18
+ struct in_place_t {
19
+ explicit in_place_t () = default;
20
+ };
21
+ LIBC_INLINE_VAR constexpr in_place_t in_place{};
22
+
23
+ template <class T > struct in_place_type_t {
24
+ explicit in_place_type_t () = default;
25
+ };
26
+ template <class T > LIBC_INLINE_VAR constexpr in_place_type_t <T> in_place_type{};
27
+
28
+ template <size_t I> struct in_place_index_t {
29
+ explicit in_place_index_t () = default;
30
+ };
31
+ template <size_t I>
32
+ LIBC_INLINE_VAR constexpr in_place_index_t <I> in_place_index{};
33
+
34
+ } // namespace __llvm_libc::cpp
35
+
36
+ #endif // LLVM_LIBC_SRC_SUPPORT_CPP_UTILITY_IN_PLACE_H
Original file line number Diff line number Diff line change @@ -344,6 +344,7 @@ libc_support_library(
344
344
"src/__support/CPP/utility.h" ,
345
345
"src/__support/CPP/utility/declval.h" ,
346
346
"src/__support/CPP/utility/forward.h" ,
347
+ "src/__support/CPP/utility/in_place.h" ,
347
348
"src/__support/CPP/utility/integer_sequence.h" ,
348
349
"src/__support/CPP/utility/move.h" ,
349
350
],
You can’t perform that action at this time.
0 commit comments