17 #ifndef ZORBA_INTERNAL_ZTD_H
18 #define ZORBA_INTERNAL_ZTD_H
25 #include <zorba/config.h>
73 #define ZORBA_DECL_HAS_MEM_FN(FN_NAME) \
74 template<typename T,typename S> \
75 class has_##FN_NAME : public sfinae_base { \
76 template<typename SignatureType,SignatureType> struct type_check; \
77 template<class U> static yes& test(type_check<S,&U::FN_NAME>*); \
78 template<class U> static no& test(...); \
80 static bool const value = sizeof( test<T>(0) ) == sizeof( yes ); \
89 namespace has_insertion_operator_impl {
98 template<
typename T>
any_t( T
const& );
134 static std::ostream &s;
178 template<
class StringType>
inline
179 typename StringType::const_pointer
c_str( StringType
const &s ) {
190 inline char const*
c_str(
char const *s ) {
231 template<
typename T>
struct less {
242 template<>
struct less<char const*> :
243 std::binary_function<char const*,char const*,bool>
250 operator()( first_argument_type a, second_argument_type b )
const {
251 return std::strcmp( a, b ) < 0;
271 template<
typename T>
inline
273 && has_insertion_operator<T>::value,
276 std::ostringstream o;
292 template<
class T>
inline
294 && has_c_str<T,char const* (T::*)() const>::value,
313 template<
class T>
inline
315 && !has_c_str<T,char const* (T::*)() const>::value
316 && has_str<T,std::string (T::*)() const>::value
317 && !has_toString<T,std::string (T::*)() const>::value,
336 template<
class T>
inline
338 && !has_c_str<T,char const* (T::*)() const>::value
339 && !has_str<T,std::string (T::*)() const>::value
340 && has_toString<T,std::string (T::*)() const>::value,
355 template<
typename T>
inline
359 return p ?
to_string( *static_cast<T_const_ptr>( p ) ) :
"<null>";
370 return s ? s :
"<null>";
390 struct pointer_conversion {
int valid; };
392 typedef int pointer_conversion::*
type;
409 return &pointer_conversion::valid;
419 template<
typename T>
static