To get a useful compile time name:
Supposing you have some unknown type named 'T'. You can get the compiler to print it's type by using it horribly. For example:
typedef typename T::something_made_up X;
The error message will be like:
error: no type named 'something_made_up' in 'Wt::Dbo::ptr<trader::model::Candle>'
The bit after 'in' shows the type. (Only tested with clang).
Other ways of triggering it:
bool x = T::nothing; // error: no member named 'nothing' in 'Wt::Dbo::ptr<trader::model::Candle>'
using X = typename T::nothing; // error: no type named 'nothing' in 'Wt::Dbo::ptr<trader::model::Candle>'
With C++11, you may already have an object and use 'decltype' to get its type, so you can also run:
auto obj = creatSomeObject();
bool x = decltype(obj)::nothing; // (Where nothing is not a real member).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…