Home | History | Annotate | Download | only in gtl

Lines Matching refs:Cleanup

16 // MakeCleanup(f) returns an RAII cleanup object that calls 'f' in its
37 // You can use Cleanup<F> directly, instead of using MakeCleanup and auto,
40 // You can call 'release()' on a Cleanup object to cancel the cleanup.
53 // A move-only RAII object that calls a stored cleanup functor when
54 // destroyed. Cleanup<F> is the return type of gtl::MakeCleanup(F).
56 class Cleanup {
58 Cleanup() : released_(true), f_() {}
61 explicit Cleanup(G&& f) // NOLINT
64 Cleanup(Cleanup&& src) // NOLINT
67 // Implicitly move-constructible from any compatible Cleanup<G>.
69 // A moved-from Cleanup can be safely destroyed or reassigned.
71 Cleanup(Cleanup<G>&& src) // NOLINT
74 // Assignment to a Cleanup object behaves like destroying it
77 Cleanup& operator=(Cleanup&& src) { // NOLINT
84 ~Cleanup() {
88 // Releases the cleanup function instead of running it.
106 TF_MUST_USE_RESULT Cleanup<DecayF> MakeCleanup(F&& f) {
107 return Cleanup<DecayF>(std::forward<F>(f));