• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef INCLUDE_CPPGC_EPHEMERON_PAIR_H_
6 #define INCLUDE_CPPGC_EPHEMERON_PAIR_H_
7 
8 #include "cppgc/member.h"
9 
10 namespace cppgc {
11 
12 /**
13  * An ephemeron pair is used to conditionally retain an object.
14  * The `value` will be kept alive only if the `key` is alive.
15  */
16 template <typename K, typename V>
17 struct EphemeronPair {
EphemeronPairEphemeronPair18   EphemeronPair(K* k, V* v) : key(k), value(v) {}
19   WeakMember<K> key;
20   Member<V> value;
21 };
22 
23 }  // namespace cppgc
24 
25 #endif  // INCLUDE_CPPGC_EPHEMERON_PAIR_H_
26