[SOLVED] CS计算机代考程序代写 #pragma once

30 $

File Name: CS计算机代考程序代写_#pragma_once.zip
File Size: 395.64 KB

SKU: 4235635503 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


#pragma once

#include

/// ContextManager is a simple RAII object for ensuring that cleanup code runs
/// when a function exits.
class ContextManager {
/// action is the cleanup code to run.It’s a std::function, so probably a
/// lambda.
std::function action;

/// runit lets us disable the reclamation in cases where we change our mind
bool runit = true;

public:
/// Construct a ContextManager by providing a function (lambda) to run on
/// destruct
ContextManager(std::function a) : action(a) {}

/// When the ContextManager goes out of scope, run its action
~ContextManager() {
if (runit)
action();
}

/// Cancel the action, to keep it from running when this object goes out of
/// scope
void cancel() { runit = false; }
};

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS计算机代考程序代写 #pragma once
30 $