---
title: "c++ 问题"
author: "aaa110110"
date: "2015-09-10T10:35:51Z"
tags: []
categories: ["编程语言"]
slug: "c"
draft: false
lastmod: "2015-09-10T11:19:55Z"
id: 2242325
url: "https://aaa110110.iteye.com/blog/2242325"
---

template&lt;&gt; struct \_\_type\_traits&lt;muduo::StringPiece&gt; {  
  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&lt;typename T&gt;  
class ThreadLocalSingleton : boost::noncopyable  
{

}  
template&lt;typename T&gt;  
\_\_thread T* ThreadLocalSingleton&lt;T&gt;::t\_value_ = 0;

template&lt;typename T&gt;  
typename ThreadLocalSingleton&lt;T&gt;::Deleter ThreadLocalSingleton&lt;T&gt;::deleter\_;

\------------------------------------------------------------------------------------------

template&lt;typename T&gt;  
struct has\_no\_destroy  
{  
  template &lt;typename C&gt; static char test(typeof(&C::no\_destroy)); // or decltype in C++11  
  template &lt;typename C&gt; static int32\_t test(...);  
  const static bool value = sizeof(test&lt;T&gt;(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&lt;MutexLock&gt; mutex\_;

 --------------------------------------------------------------------------

\_\_thread char t\_errnobuf\[512];  
\_\_thread char t\_time\[32];  
\_\_thread time\_t t\_lastSecond;

\---------------------------------------------------------------------  
  self& operator&lt;&lt;(const unsigned char* str)  
  {  
    return operator&lt;&lt;(reinterpret\_cast&lt;const char\*&gt;(str));  
  }

\------------------------------------------------------------------  
class Fmt // : boost::noncopyable  
{  
 public:  
  template&lt;typename T&gt;  
  Fmt(const char* fmt, T val);

  const char* data() const { return buf\_; }  
  int length() const { return length\_; }

 private:  
  char buf\_\[32];  
  int length\_;  
};

\-------------------------------------------------------------------------

 

右值引用