util/Cast: reimplement as template without macro

This commit is contained in:
Max Kellermann
2014-07-14 16:24:07 +02:00
parent f8da8b0261
commit 7a1f3177c9
3 changed files with 33 additions and 16 deletions

View File

@@ -87,10 +87,13 @@ calc_hash(TagType type, const char *p)
return hash ^ type;
}
static inline constexpr TagPoolSlot *
#if defined(__clang__) || GCC_CHECK_VERSION(4,7)
constexpr
#endif
static inline TagPoolSlot *
tag_item_to_slot(TagItem *item)
{
return ContainerCast(item, TagPoolSlot, item);
return &ContainerCast(*item, &TagPoolSlot::item);
}
static inline TagPoolSlot **