aboutsummaryrefslogtreecommitdiffstats
path: root/meowpp/utility
diff options
context:
space:
mode:
authorcathook <b01902109@csie.ntu.edu.tw>2014-10-18 04:31:29 +0800
committercathook <b01902109@csie.ntu.edu.tw>2014-10-18 04:31:29 +0800
commitbf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358 (patch)
treea3da5d1be7bfb608703e41c2f9961beecc96ab4a /meowpp/utility
parentbdd57ee36a800e6772c3dcdc5570bf32f648f761 (diff)
downloadmeow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.tar
meow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.tar.gz
meow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.tar.bz2
meow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.tar.lz
meow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.tar.xz
meow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.tar.zst
meow-bf5c9f2ae5c436aa7f59b28bb5e94b0362bfa358.zip
Move the syntax package to the meowpp/ folder
Diffstat (limited to 'meowpp/utility')
-rw-r--r--meowpp/utility/syntax.h29
-rw-r--r--meowpp/utility/syntax_test.cpp24
2 files changed, 0 insertions, 53 deletions
diff --git a/meowpp/utility/syntax.h b/meowpp/utility/syntax.h
deleted file mode 100644
index 9273e47..0000000
--- a/meowpp/utility/syntax.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __MEOWPP_SYNTAX_H__
-#define __MEOWPP_SYNTAX_H__
-
-
-/**
- * @brief For creating a scope with some local variable.
- * @param x Something to do at the start of this scope (can also be a declartion
- * of some variable.
- *
- * Example:
- * @code{.cpp}
- * int a = 5, b = 7;
- * with (int tmp_var = a) { // tmp_var will be a local variable with scope
- * // between this two brackets.
- * a = b;
- * b = tmp_var;
- * }
- * // You cannot access "tmp_var" outside.
- *
- * with (SomeObject obj) { // Creates the object.
- * // Do something.
- * } // Destroy the object.
- *
- * @endcode
- */
-#define with(x) for (x; false; )
-
-
-#endif // __MEOWPP_SYNTAX_H__
diff --git a/meowpp/utility/syntax_test.cpp b/meowpp/utility/syntax_test.cpp
deleted file mode 100644
index 3a7cc9c..0000000
--- a/meowpp/utility/syntax_test.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <meowpp/utility/syntax.h>
-#include <meowpp/debug/assert.h>
-
-class SomeObj {
- private:
- int* flag;
- public:
- SomeObj(int* a_flag) : flag(a_flag) { (*flag) |= 1; }
- ~SomeObj() { (*flag) |= 2; }
-};
-
-int main() {
- int flag = 0;
- with (SomeObj obj(&flag)) {
- Assert(flag == 1, "No constructor?");
- }
- Assert(flag == 3, "No destructor?");
-
- flag = 0;
- with (SomeObj obj(&flag))
- Assert(flag == 1, "No constructor?");
- Assert(flag == 3, "No destructor?");
- return 0;
-}