aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.h
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-01 01:27:27 +0800
committerGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 14:58:48 +0800
commit78ab7e7ba12036140941e145ed338a126125f487 (patch)
treea84b42702caad7ba1926c95d121a07185c753bd7 /common.h
parent424bb589a22cfa6b2ceaba2a9edc61c08e46f74a (diff)
Introduce a macro CAST_INIT to abbreviate common static_cast's a bit
This macro doesn't work with type names containing commas, but that doesn't seem to be too common in fish.
Diffstat (limited to 'common.h')
-rw-r--r--common.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/common.h b/common.h
index 9c852f18..26833400 100644
--- a/common.h
+++ b/common.h
@@ -22,6 +22,12 @@
#include <assert.h>
#include "util.h"
+/**
+ Avoid writing the type name twice in a common "static_cast-initialization".
+ Caveat: This doesn't work with type names containing commas!
+*/
+#define CAST_INIT(type, dst, src) type dst = static_cast<type >(src)
+
class completion_t;
/* Common string type */