https://github.com/CryptDB/cryptdb
Tip revision: 7678bc98d3054f1418371779c6d1050cd1a88b2e authored by Raluca Ada Popa on 04 January 2014, 01:31:06 UTC
small changes to readme
small changes to readme
Tip revision: 7678bc9
cleanup.hh
#pragma once
/*
* ANON generates a unique identifier, useful in cases when the
* name of some object or class doesn't matter.
*/
#include "string.h"
#define ANON_CONCAT2(a, b) a ## b
#define ANON_CONCAT(a, b) ANON_CONCAT2(a, b)
#define ANON_NAME(name) ANON_CONCAT(name, __COUNTER__)
/*
* Cleanup handler object: invokes the supplied function in its
* destructor.
*/
template<class T>
class cleanup_caller {
public:
cleanup_caller(T a) : action(a) {}
~cleanup_caller() { action(); }
private:
T action;
};
template<class T>
cleanup_caller<T>
cleanup(T a)
{
return cleanup_caller<T>(a);
}