Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/node/cppgc/internal/conditional-stack-allocated.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Copyright 2025 the V8 project authors. All rights reserved.
0002 // Use of this source code is governed by a BSD-style license that can be
0003 // found in the LICENSE file.
0004 
0005 #ifndef INCLUDE_CPPGC_INTERNAL_CONDITIONAL_STACK_ALLOCATED_H_
0006 #define INCLUDE_CPPGC_INTERNAL_CONDITIONAL_STACK_ALLOCATED_H_
0007 
0008 #include <type_traits>
0009 
0010 #include "cppgc/macros.h"       // NOLINT(build/include_directory)
0011 #include "cppgc/type-traits.h"  // NOLINT(build/include_directory)
0012 
0013 namespace cppgc {
0014 namespace internal {
0015 
0016 // Base class that is marked as stack allocated if T is either marked as stack
0017 // allocated or a traceable type.
0018 template <typename T>
0019 class ConditionalStackAllocatedBase;
0020 
0021 template <typename T>
0022 concept RequiresStackAllocated =
0023     !std::is_void_v<T> &&
0024     (cppgc::IsStackAllocatedType<T> || cppgc::internal::IsTraceableV<T> ||
0025      cppgc::IsGarbageCollectedOrMixinTypeV<T>);
0026 
0027 template <typename T>
0028   requires(RequiresStackAllocated<T>)
0029 class ConditionalStackAllocatedBase<T> {
0030  public:
0031   CPPGC_STACK_ALLOCATED();
0032 };
0033 
0034 template <typename T>
0035   requires(!RequiresStackAllocated<T>)
0036 class ConditionalStackAllocatedBase<T> {};
0037 
0038 }  // namespace internal
0039 }  // namespace cppgc
0040 
0041 #endif  // INCLUDE_CPPGC_INTERNAL_CONDITIONAL_STACK_ALLOCATED_H_