* ./hurricane/src/hurricane :

- Bug: strange interraction between template, const Data and getString().
        Must const_cast<> to const datas before calling getString().
This commit is contained in:
Jean-Paul Chaput 2009-03-30 21:26:37 +00:00
parent abbc94ea90
commit 57a0035247
2 changed files with 6 additions and 3 deletions

View File

@ -545,7 +545,10 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
# define GETSTRING_POINTER_SUPPORT(Data) \
template<> inline std::string getString<Data*>( Data* data ) \
{ if (!data) return "NULL [" #Data "]"; return data->_getString(); } \
{ \
if (!data) return "NULL [" #Data "]"; \
return const_cast<const Data*>(data)->_getString(); \
} \
\
template<> inline std::string getString<const Data*>( const Data* data ) \
{ if (!data) return "NULL [const " #Data "]"; return data->_getString(); }
@ -555,7 +558,7 @@ inline Hurricane::Record* getRecord ( const std::multiset<Element,Compare>* s )
inline std::ostream& operator<< ( std::ostream& o, Data* d ) \
{ \
if (!d) return o << "NULL [" #Data "]"; \
return o << "&" << getString<Data*>(d); \
return o << "&" << getString<const Data*>(d); \
} \
inline std::ostream& operator<< ( std::ostream& o, const Data* d ) \
{ \