mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
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.
This commit is contained in:
parent
424bb589a2
commit
78ab7e7ba1
1 changed files with 6 additions and 0 deletions
6
common.h
6
common.h
|
@ -22,6 +22,12 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "util.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;
|
class completion_t;
|
||||||
|
|
||||||
/* Common string type */
|
/* Common string type */
|
||||||
|
|
Loading…
Reference in a new issue