【发布时间】:2011-10-28 15:26:52
【问题描述】:
带有如下声明:
enum DrawBoldMode : unsigned
{
DBM_NONE = 0,
DBM_ITEM = 1<<0, // bold just the nearest line
DBM_SECTION = 1<<1, // bold all lines in the same section
DBM_LINETYPE = 1<<2, // bold all lines of the same line type
DBM_POINTAGE = 1<<3, // bold all lines of the same line type
};
如何导出 DrawBoldMode 的底层类型(即无符号)?
【问题讨论】:
-
顺便说一句,2^0 是 2 XOR 0。我相信你想要 (1
-
这似乎不可能,模板或其他。
-
我不认为可以做到,除非所有底层类型都是唯一的大小。
-
D'oh-我永远忘记了 C++ 中的 x^y 是 xor not power。叹息...:P