1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef TupleCycleCollection_h
8 #define TupleCycleCollection_h
9 
10 #include "mozilla/Tuple.h"
11 #include "nsCycleCollectionNoteChild.h"
12 
13 class nsCycleCollectionTraversalCallback;
14 
15 template <typename... Elements>
ImplCycleCollectionUnlink(mozilla::Tuple<Elements...> & aField)16 inline void ImplCycleCollectionUnlink(mozilla::Tuple<Elements...>& aField) {
17   ForEach(aField, [](auto& aElem) { ImplCycleCollectionUnlink(aElem); });
18 }
19 
20 template <typename... Elements>
21 inline void ImplCycleCollectionTraverse(
22     nsCycleCollectionTraversalCallback& aCallback,
23     mozilla::Tuple<Elements...>& aField, const char* aName,
24     uint32_t aFlags = 0) {
25   aFlags |= CycleCollectionEdgeNameArrayFlag;
26   ForEach(aField, [&](auto& aElem) {
27     ImplCycleCollectionTraverse(aCallback, aElem, aName, aFlags);
28   });
29 }
30 
31 #endif  // TupleCycleCollection_h
32