26 template<
typename T,
typename BaseT =
void>
27 struct shared :
public std::conditional<std::is_same<BaseT, void>::value, std::enable_shared_from_this<T>, BaseT>::type
29 static_assert(std::is_same<BaseT, void>::value || std::is_base_of<
shared<BaseT>, BaseT>::value,
30 "shared<T, BaseT> requires a void base or a base that derives from shared<BaseT>");
31 operator std::shared_ptr<T>() {
return std::static_pointer_cast<T>(
static_cast<T *
>(
this)->shared_from_this()); }
33 operator std::shared_ptr<const T>()
const
35 return std::static_pointer_cast<const T>(
static_cast<const T *
>(
this)->shared_from_this());
40 typename std::conditional<std::is_same<BaseT, void>::value, std::enable_shared_from_this<T>, BaseT>::type;
41 using ActualBase::ActualBase;