[libc++][NFC] Simplify the implementation of string and string_views operator== ...
[llvm-project.git] / libc / src / __support / CPP / utility / in_place.h
blob3967eb1c535e45682ada54cfddf2f4b786926dbd
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
11 #include "src/__support/macros/attributes.h" // LIBC_INLINE, LIBC_INLINE_VAR
12 #include "src/__support/macros/config.h"
14 #include <stddef.h> // size_t
16 namespace LIBC_NAMESPACE_DECL {
17 namespace cpp {
19 // in_place
20 struct in_place_t {
21 LIBC_INLINE explicit in_place_t() = default;
23 LIBC_INLINE_VAR constexpr in_place_t in_place{};
25 template <class T> struct in_place_type_t {
26 LIBC_INLINE explicit in_place_type_t() = default;
28 template <class T> LIBC_INLINE_VAR constexpr in_place_type_t<T> in_place_type{};
30 template <size_t IDX> struct in_place_index_t {
31 LIBC_INLINE explicit in_place_index_t() = default;
33 template <size_t IDX>
34 LIBC_INLINE_VAR constexpr in_place_index_t<IDX> in_place_index{};
36 } // namespace cpp
37 } // namespace LIBC_NAMESPACE_DECL
39 #endif // LLVM_LIBC_SRC___SUPPORT_CPP_UTILITY_IN_PLACE_H