diff options
author | Cheer Xiao <xiaqqaix@gmail.com> | 2013-01-01 01:27:27 +0800 |
---|---|---|
committer | Cheer Xiao <xiaqqaix@gmail.com> | 2013-01-17 14:58:48 +0800 |
commit | 78ab7e7ba12036140941e145ed338a126125f487 (patch) | |
tree | a84b42702caad7ba1926c95d121a07185c753bd7 /common.h | |
parent | 424bb589a22cfa6b2ceaba2a9edc61c08e46f74a (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.h | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 */ |