`
aaa110110
  • 浏览: 16847 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

c++ 问题

 
阅读更多

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_;
};


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

 

右值引用

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics