[meta] Add is_trivially_destructible
This commit is contained in:
parent
72cb5b8e52
commit
f2398f34c0
|
@ -344,9 +344,9 @@ using hb_is_move_assignable = hb_is_assignable<hb_add_lvalue_reference<T>,
|
|||
template <typename T> union hb_trivial { T value; };
|
||||
|
||||
/* Don't know how to do the following. */
|
||||
//template <typename T>
|
||||
//using hb_is_trivially_destructible= hb_is_destructible<hb_trivial<T>>;
|
||||
//#define hb_is_trivially_destructible(T) hb_is_trivially_destructible<T>::value
|
||||
template <typename T>
|
||||
using hb_is_trivially_destructible= hb_is_destructible<hb_trivial<T>>;
|
||||
#define hb_is_trivially_destructible(T) hb_is_trivially_destructible<T>::value
|
||||
|
||||
/* Don't know how to do the following. */
|
||||
//template <typename T, typename ...Ts>
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "hb.hh"
|
||||
#include "hb-meta.hh"
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
@ -57,6 +59,7 @@ main (int argc, char **argv)
|
|||
static_assert (hb_is_convertible (const int&, const int), "");
|
||||
|
||||
struct X {};
|
||||
struct Y : X {};
|
||||
|
||||
static_assert (hb_is_convertible (const X &, const X), "");
|
||||
static_assert (hb_is_convertible (X &, const X), "");
|
||||
|
@ -77,8 +80,6 @@ main (int argc, char **argv)
|
|||
static_assert (hb_is_convertible (int *, void *), "");
|
||||
static_assert (!hb_is_convertible (void *, int *), "");
|
||||
|
||||
struct Y : X {};
|
||||
|
||||
static_assert (hb_is_base_of (void, void), "");
|
||||
static_assert (hb_is_base_of (void, int), "");
|
||||
static_assert (!hb_is_base_of (int, void), "");
|
||||
|
@ -112,6 +113,8 @@ main (int argc, char **argv)
|
|||
static_assert (hb_is_trivially_copy_constructible (Y), "");
|
||||
static_assert (hb_is_trivially_move_constructible (X), "");
|
||||
static_assert (hb_is_trivially_move_constructible (Y), "");
|
||||
static_assert (hb_is_trivially_destructible (Y), "");
|
||||
|
||||
/* TODO Add more meaningful tests. */
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue