44 using LERR_(BOTTOM_VALUE);
45 using LERR_(WRONG_TYPE);
74 ostream& operator<< (ostream& s,
const B& b) {
return s <<
"B{} adr="<<&b; }
75 ostream& operator<< (ostream& s,
const D& d) {
return s <<
"D{} adr="<<&d; }
76 ostream& operator<< (ostream& s,
const E& e) {
return s <<
"E{} adr="<<&e; }
77 ostream& operator<< (ostream& s,
const F& f) {
return s <<
"F{} adr="<<&f; }
118 cout <<
"can_downcast<B,D> = " << can_downcast<B,D>::value <<endl;
119 cout <<
"can_downcast<B*,D*> = " << can_downcast<B*,D*>::value <<endl;
120 cout <<
"can_downcast<B&,D&> = " << can_downcast<B&,D&>::value <<endl;
121 cout <<
"can_downcast<B&,D*> = " << can_downcast<B&,D*>::value <<endl;
122 cout <<
"can_downcast<B*,D&> = " << can_downcast<B*,D&>::value <<endl;
123 cout <<
"can_downcast<B*&,D*&> = " << can_downcast<B*&,D*&>::value <<endl;
124 cout <<
"can_downcast<D*&,D*&> = " << can_downcast<D*&,D*&>::value <<endl;
126 cout <<
"can_downcast<D*,E*> = " << can_downcast<D*,E*>::value <<endl;
127 cout <<
"can_downcast<E*,F*> = " << can_downcast<E*,F*>::value <<endl;
129 cout <<
"has_RTTI<D*> = " << has_RTTI<D*>::value <<endl;
130 cout <<
"has_RTTI<E*> = " << has_RTTI<E*>::value <<endl;
131 cout <<
"has_RTTI<F*> = " << has_RTTI<F*>::value <<endl;
133 cout <<
"is_convertible<D,D&> = " << std::is_convertible<D,D&>::value <<endl;
134 cout <<
"is_convertible<D&,D> = " << std::is_convertible<D&,D>::value <<endl;
137 cout <<
"can_use_dynamic_downcast<D,D&> = " << can_use_dynamic_downcast<D,D&>::value <<endl;
138 cout <<
"can_use_conversion<D,D&> = " << can_use_conversion<D,D&>::value <<endl;
139 cout <<
"can_use_dynamic_downcast<B*,D*> = " << can_use_dynamic_downcast<B*,D*>::value <<endl;
140 cout <<
"can_use_conversion<D*,B*> = " << can_use_conversion<D*,B*>::value <<endl;
142 cout <<
"can_use_dynamic_downcast<D*&,D*&> = " << can_use_dynamic_downcast<D*&,D*&>::value <<endl;
143 cout <<
"can_use_conversion<D*&,D*&> = " << can_use_conversion<D*&,D*&>::value <<endl;
144 cout <<
"can_use_conversion<D*,E*> = " << can_use_conversion<D*,E*>::value <<endl;
145 cout <<
"can_use_dynamic_downcast<D*&,E*> = " << can_use_dynamic_downcast<D*&,E*>::value <<endl;
146 cout <<
"can_use_conversion<E*,F*> = " << can_use_conversion<E*,F*>::value <<endl;
147 cout <<
"can_use_dynamic_downcast<E*,F*> = " << can_use_dynamic_downcast<E*,F*>::value <<endl;
151 cout <<
"=== standard case: References ==="<<endl;
159 cout <<
"=== build a value object ==="<<endl;
164 cout <<
"=== take a pointer ==="<<endl;
169 cout <<
"=== dereference a pointer ==="<<endl;
178 cout <<
"=== const correctness ==="<<endl;
210 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.
Simple 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, bypassing any custom comparison operators.