aboutsummaryrefslogtreecommitdiff
path: root/external/glim/raii.hpp
diff options
context:
space:
mode:
authorThomas Winget <tewinget@gmail.com>2014-10-31 17:36:26 -0400
committerwarptangent <warptangent@inbox.com>2015-01-04 19:31:20 -0800
commit767aac274b13b9d3b7e73375c44f1a5fec563a00 (patch)
tree58174ce2e21ca6deac5a3ddffcf7744829d00adc /external/glim/raii.hpp
parentStore output pubkeys separately, bug fixes (diff)
downloadmonero-767aac274b13b9d3b7e73375c44f1a5fec563a00.tar.xz
Remove unused dependency
Diffstat (limited to 'external/glim/raii.hpp')
-rw-r--r--external/glim/raii.hpp34
1 files changed, 0 insertions, 34 deletions
diff --git a/external/glim/raii.hpp b/external/glim/raii.hpp
deleted file mode 100644
index a09d35776..000000000
--- a/external/glim/raii.hpp
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <functional>
-namespace glim {
-
-// http://stackoverflow.com/questions/2121607/any-raii-template-in-boost-or-c0x/
-
-/// RAII helper. Keeps the functor and runs it in the destructor.
-/// Example: \code auto unmap = raiiFun ([&]() {munmap (fd, size);}); \endcode
-template<typename Fun> struct RAIIFun {
- Fun _fun;
- RAIIFun (RAIIFun&&) = default;
- RAIIFun (const RAIIFun&) = default;
- template<typename FunArg> RAIIFun (FunArg&& fun): _fun (std::forward<Fun> (fun)) {}
- ~RAIIFun() {_fun();}
-};
-
-/// The idea to name it `finally` comes from http://www.codeproject.com/Tips/476970/finally-clause-in-Cplusplus.
-/// Example: \code finally unmap ([&]() {munmap (fd, size);}); \endcode
-typedef RAIIFun<std::function<void(void)>> finally;
-
-/// Runs the given functor when going out of scope.
-/// Example: \code
-/// auto closeFd = raiiFun ([&]() {close (fd);});
-/// auto unmap = raiiFun ([&]() {munmap (fd, size);});
-/// \endcode
-template<typename Fun> RAIIFun<Fun> raiiFun (const Fun& fun) {return RAIIFun<Fun> (fun);}
-
-/// Runs the given functor when going out of scope.
-/// Example: \code
-/// auto closeFd = raiiFun ([&]() {close (fd);});
-/// auto unmap = raiiFun ([&]() {munmap (fd, size);});
-/// \endcode
-template<typename Fun> RAIIFun<Fun> raiiFun (Fun&& fun) {return RAIIFun<Fun> (std::move (fun));}
-
-}