• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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" // LIBC_INLINE, LIBC_INLINE_VAR
12 
13 #include <stddef.h> // size_t
14 
15 namespace LIBC_NAMESPACE::cpp {
16 
17 // in_place
18 struct in_place_t {
19   LIBC_INLINE 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   LIBC_INLINE 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   LIBC_INLINE 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 LIBC_NAMESPACE::cpp
35 
36 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H
37