proxygen
folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper Struct Reference

Public Types

template<typename S >
using MakeRet = is_invocable_r< S, Make >
 

Public Member Functions

 operator T & ()
 
template<typename S = T, _t< std::enable_if< MakeRet< S >::value, int >> = 0>
 Wrapper ()
 
template<typename S = T, _t< std::enable_if<!MakeRet< S >::value, int >> = 0>
 Wrapper ()
 
 ~Wrapper ()
 

Public Attributes

union {
   unsigned char   storage [sizeof(T)]
 
   T   object
 
}; 
 
List caches
 

Detailed Description

template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
struct folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper

Definition at line 97 of file SingletonThreadLocal.h.

Member Typedef Documentation

template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
template<typename S >
using folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::MakeRet = is_invocable_r<S, Make>

Definition at line 99 of file SingletonThreadLocal.h.

Constructor & Destructor Documentation

template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
template<typename S = T, _t< std::enable_if< MakeRet< S >::value, int >> = 0>
folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::Wrapper ( )
inline

Definition at line 114 of file SingletonThreadLocal.h.

References value.

114  {
115  (void)new (storage) S(Make{}());
116  }
template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
template<typename S = T, _t< std::enable_if<!MakeRet< S >::value, int >> = 0>
folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::Wrapper ( )
inline

Definition at line 119 of file SingletonThreadLocal.h.

119  {
120  (void)Make{}(storage);
121  }
template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::~Wrapper ( )
inline

Definition at line 122 of file SingletonThreadLocal.h.

122  {
123  for (auto& node : caches) {
124  node.clear();
125  }
126  caches.clear();
127  object.~T();
128  }

Member Function Documentation

template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::operator T & ( )
inline

Definition at line 108 of file SingletonThreadLocal.h.

References object, and value.

108  {
109  return object;
110  }

Member Data Documentation

union { ... }
template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
List folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::caches

Definition at line 106 of file SingletonThreadLocal.h.

template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
T folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::object

Definition at line 104 of file SingletonThreadLocal.h.

template<typename T, typename Tag = detail::DefaultTag, typename Make = detail::DefaultMake<T>, typename TLTag = _t<std::conditional< std::is_same<Tag, detail::DefaultTag>::value, void, Tag>>>
unsigned char folly::SingletonThreadLocal< T, Tag, Make, TLTag >::Wrapper::storage[sizeof(T)]

Definition at line 103 of file SingletonThreadLocal.h.


The documentation for this struct was generated from the following file: