20 #ifndef MINSKY_OPTIONAL_H 21 #define MINSKY_OPTIONAL_H 22 #include <xsd_generate_base.h> 31 static auto check(X x)->decltype(x.empty());
32 static std::false_type
check(...);
34 static constexpr
const bool value = std::is_integral<decltype(check(std::declval<T>()))>::
value;
46 typename classdesc::enable_if<has_empty<U>,
void>::T
47 assign(
const U& x, classdesc::dummy<0> d=0) {
48 if (!x.empty()) this->
reset(
new T(x));
51 typename classdesc::enable_if<classdesc::Not<has_empty<U>>,
void>::T
52 assign(
const U& x, classdesc::dummy<1> d=0) {this->
reset(
new T(x));}
69 #pragma omit xsd_generate minsky::Optional 70 #pragma omit xml_pack minsky::Optional 79 xsd_generate_t::Optional o(g,
true);
91 #include "optional.cd" 92 #include "optional.xcd"
static auto check(X x) -> decltype(x.empty())
Optional(const Optional< U > &x)
void xsd_generate(xsd_generate_t &g, const string &d, const minsky::Optional< T > &a)
convenience class to omit writing XML records when data absent or empty
classdesc::enable_if< has_empty< U >, void >::T assign(const U &x, classdesc::dummy< 0 > d=0)
Creation and access to the minskyTCL_obj object, which has code to record whenever Minsky's state cha...
const T * operator->() const
void xml_pack(xml_pack_t &t, const string &d, minsky::Optional< T > &a)
const T & operator*() const
Optional & operator=(const U &x)
static constexpr const bool value
classdesc::enable_if< classdesc::Not< has_empty< U > >, void >::T assign(const U &x, classdesc::dummy< 1 > d=0)