template<> struct __type_traits<muduo::StringPiece> {
typedef __true_type has_trivial_default_constructor;
typedef __true_type has_trivial_copy_constructor;
typedef __true_type has_trivial_assignment_operator;
typedef __true_type has_trivial_destructor;
typedef __true_type is_POD_type;
};
--------------------------------------------------------------------------------------------
template<typename T>
class ThreadLocalSingleton : boost::noncopyable
{
}
template<typename T>
__thread T* ThreadLocalSingleton<T>::t_value_ = 0;
template<typename T>
typename ThreadLocalSingleton<T>::Deleter ThreadLocalSingleton<T>::deleter_;
------------------------------------------------------------------------------------------
template<typename T>
struct has_no_destroy
{
template <typename C> static char test(typeof(&C::no_destroy)); // or decltype in C++11
template <typename C> static int32_t test(...);
const static bool value = sizeof(test<T>(0)) == 1;
};
}
----------------------------------------------------------------------------
#ifdef NDEBUG
__BEGIN_DECLS
extern void __assert_perror_fail (int errnum,
const char *file,
unsigned int line,
const char *function)
__THROW __attribute__ ((__noreturn__));
__END_DECLS
#endif
-------------------------------------------------------------------------
boost::scoped_ptr<MutexLock> mutex_;
--------------------------------------------------------------------------
__thread char t_errnobuf[512];
__thread char t_time[32];
__thread time_t t_lastSecond;
---------------------------------------------------------------------
self& operator<<(const unsigned char* str)
{
return operator<<(reinterpret_cast<const char*>(str));
}
------------------------------------------------------------------
class Fmt // : boost::noncopyable
{
public:
template<typename T>
Fmt(const char* fmt, T val);
const char* data() const { return buf_; }
int length() const { return length_; }
private:
char buf_[32];
int length_;
};
-------------------------------------------------------------------------
右值引用