func_def eliminated

This commit is contained in:
Nekotekina 2015-07-26 15:10:06 +03:00
parent 31774b7262
commit be2f993155
35 changed files with 81 additions and 97 deletions

View file

@ -119,26 +119,10 @@ struct explicit_bool_t
};
// return 32 bit sizeof() to avoid widening/narrowing conversions with size_t
#define sizeof32(type) static_cast<u32>(sizeof32_t<sizeof(type)>::value)
#define sizeof32(type) static_cast<u32>(sizeof(type))
// return 32 bit alignof() to avoid widening/narrowing conversions with size_t
#define alignof32(type) static_cast<u32>(alignof32_t<__alignof(type)>::value)
template<std::size_t Size> struct sizeof32_t
{
static_assert(Size <= UINT32_MAX, "sizeof32() error: size is too big");
enum : u32 { value = static_cast<u32>(Size) };
};
template<std::size_t Align> struct alignof32_t
{
static_assert(Align <= UINT32_MAX, "alignof32() error: alignment is too big");
enum : u32 { value = static_cast<u32>(Align) };
};
template<typename T> using func_def = T; // workaround for MSVC bug: `using X = func_def<void()>;` instead of `using X = void();`
#define alignof32(type) static_cast<u32>(__alignof(type))
template<typename T> struct ID_type;