Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Roblox
GitHub Repository: Roblox/luau
Path: blob/master/Common/include/Luau/ScopedSeenSet.h
2727 views
1
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2
#pragma once
3
4
namespace Luau
5
{
6
7
template<typename SetType, typename Key>
8
struct ScopedSeenSet
9
{
10
SetType& seen;
11
Key key;
12
13
ScopedSeenSet(SetType& seen, Key key)
14
: seen(seen)
15
, key(key)
16
{
17
seen.insert(key);
18
}
19
20
~ScopedSeenSet()
21
{
22
seen.erase(key);
23
}
24
25
ScopedSeenSet(const ScopedSeenSet&) = delete;
26
ScopedSeenSet& operator=(const ScopedSeenSet&) = delete;
27
};
28
29
} // namespace Luau
30
31