35 using LERR_(BOTTOM_VALUE);
36 using LERR_(WRONG_TYPE);
65 ostream& operator<< (ostream& s,
const B& b) {
return s <<
"B{} adr="<<&b; }
66 ostream& operator<< (ostream& s,
const D& d) {
return s <<
"D{} adr="<<&d; }
67 ostream& operator<< (ostream& s,
const E& e) {
return s <<
"E{} adr="<<&e; }
68 ostream& operator<< (ostream& s,
const F& f) {
return s <<
"F{} adr="<<&f; }
109 cout <<
"can_downcast<B,D> = " << can_downcast<B,D>::value <<endl;
110 cout <<
"can_downcast<B*,D*> = " << can_downcast<B*,D*>::value <<endl;
111 cout <<
"can_downcast<B&,D&> = " << can_downcast<B&,D&>::value <<endl;
112 cout <<
"can_downcast<B&,D*> = " << can_downcast<B&,D*>::value <<endl;
113 cout <<
"can_downcast<B*,D&> = " << can_downcast<B*,D&>::value <<endl;
114 cout <<
"can_downcast<B*&,D*&> = " << can_downcast<B*&,D*&>::value <<endl;
115 cout <<
"can_downcast<D*&,D*&> = " << can_downcast<D*&,D*&>::value <<endl;
117 cout <<
"can_downcast<D*,E*> = " << can_downcast<D*,E*>::value <<endl;
118 cout <<
"can_downcast<E*,F*> = " << can_downcast<E*,F*>::value <<endl;
120 cout <<
"has_RTTI<D*> = " << has_RTTI<D*>::value <<endl;
121 cout <<
"has_RTTI<E*> = " << has_RTTI<E*>::value <<endl;
122 cout <<
"has_RTTI<F*> = " << has_RTTI<F*>::value <<endl;
124 cout <<
"is_convertible<D,D&> = " << std::is_convertible<D,D&>::value <<endl;
125 cout <<
"is_convertible<D&,D> = " << std::is_convertible<D&,D>::value <<endl;
128 cout <<
"can_use_dynamic_downcast<D,D&> = " << can_use_dynamic_downcast<D,D&>::value <<endl;
129 cout <<
"can_use_conversion<D,D&> = " << can_use_conversion<D,D&>::value <<endl;
130 cout <<
"can_use_dynamic_downcast<B*,D*> = " << can_use_dynamic_downcast<B*,D*>::value <<endl;
131 cout <<
"can_use_conversion<D*,B*> = " << can_use_conversion<D*,B*>::value <<endl;
133 cout <<
"can_use_dynamic_downcast<D*&,D*&> = " << can_use_dynamic_downcast<D*&,D*&>::value <<endl;
134 cout <<
"can_use_conversion<D*&,D*&> = " << can_use_conversion<D*&,D*&>::value <<endl;
135 cout <<
"can_use_conversion<D*,E*> = " << can_use_conversion<D*,E*>::value <<endl;
136 cout <<
"can_use_dynamic_downcast<D*&,E*> = " << can_use_dynamic_downcast<D*&,E*>::value <<endl;
137 cout <<
"can_use_conversion<E*,F*> = " << can_use_conversion<E*,F*>::value <<endl;
138 cout <<
"can_use_dynamic_downcast<E*,F*> = " << can_use_dynamic_downcast<E*,F*>::value <<endl;
142 cout <<
"=== standard case: References ==="<<endl;
150 cout <<
"=== build a value object ==="<<endl;
155 cout <<
"=== take a pointer ==="<<endl;
160 cout <<
"=== dereference a pointer ==="<<endl;
169 cout <<
"=== const correctness ==="<<endl;
201 cout <<
"=== work cases: actual conversions ==="<<endl;
Helper template to access a given value, possibly converted or casted in a safe way.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Simplistic test class runner.
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
A collection of frequently used helper functions to support unit testing.
Helper for accessing a value, employing either a conversion or downcast, depending on the relation of...
bool isSameObject(A const &a, B const &b)
compare plain object identity, based directly on the referee's memory identities. ...