Changeset View
Changeset View
Standalone View
Standalone View
src/bench/prevector.cpp
Show All 14 Lines | |||||
#define IS_TRIVIALLY_CONSTRUCTIBLE std::has_trivial_default_constructor | #define IS_TRIVIALLY_CONSTRUCTIBLE std::has_trivial_default_constructor | ||||
#else | #else | ||||
#define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_default_constructible | #define IS_TRIVIALLY_CONSTRUCTIBLE std::is_trivially_default_constructible | ||||
#endif | #endif | ||||
struct nontrivial_t { | struct nontrivial_t { | ||||
int x; | int x; | ||||
nontrivial_t() : x(-1) {} | nontrivial_t() : x(-1) {} | ||||
ADD_SERIALIZE_METHODS | SERIALIZE_METHODS(nontrivial_t, obj) { READWRITE(obj.x); } | ||||
template <typename Stream, typename Operation> | |||||
inline void SerializationOp(Stream &s, Operation ser_action) { | |||||
READWRITE(x); | |||||
} | |||||
}; | }; | ||||
static_assert(!IS_TRIVIALLY_CONSTRUCTIBLE<nontrivial_t>::value, | static_assert(!IS_TRIVIALLY_CONSTRUCTIBLE<nontrivial_t>::value, | ||||
"expected nontrivial_t to not be trivially constructible"); | "expected nontrivial_t to not be trivially constructible"); | ||||
typedef uint8_t trivial_t; | typedef uint8_t trivial_t; | ||||
static_assert(IS_TRIVIALLY_CONSTRUCTIBLE<trivial_t>::value, | static_assert(IS_TRIVIALLY_CONSTRUCTIBLE<trivial_t>::value, | ||||
"expected trivial_t to be trivially constructible"); | "expected trivial_t to be trivially constructible"); | ||||
▲ Show 20 Lines • Show All 72 Lines • Show Last 20 Lines |