5 #ifndef _XDRPP_CLEAR_H_HEADER_INCLUDED_ 6 #define _XDRPP_CLEAR_H_HEADER_INCLUDED_ 1 17 Constexpr xdr_clear_t() {}
19 template<
typename T>
typename 20 std::enable_if<xdr_traits<T>::variable_nelem>::type
21 operator()(T &t)
const { t.resize(0); }
23 template<std::u
int32_t N>
void operator()(opaque_array<N> &t)
const {
24 std::memset(t.data(), 0, t.size());
27 template<
typename T>
typename 28 std::enable_if<xdr_traits<T>::is_struct>::type
29 operator()(T &t)
const { xdr_traits<T>::load(*
this, t); }
31 template<
typename T>
typename 32 std::enable_if<!xdr_traits<T>::variable_nelem>::type
33 operator()(T &t)
const { xdr_traits<T>::load(*
this, t); }
35 template<
typename T>
typename std::enable_if<xdr_traits<T>::is_union>::type
36 operator()(T &t)
const {
37 auto dt =
typename xdr_traits<T>::discriminant_type{};
38 if (t._xdr_field_number(dt) > 0)
39 xdr_traits<T>::load(*
this, t);
41 t._xdr_discriminant(dt,
false);
44 template<
typename T>
typename 46 operator()(T &t)
const { t = T{}; }
54 template<
typename T>
void 57 static Constexpr detail::xdr_clear_t c;
63 #endif // !_XDRPP_CLEAR_H_HEADER_INCLUDED void xdr_clear(T &t)
Reset XDR data structure to its default contents.
Type definitions for xdrc compiler output.
Most of the xdrpp library is encapsulated in the xdr namespace.
static Constexpr const bool is_enum
T is an XDR enum or bool (traits have enum_name).