fork download
  1. #include <iostream>
  2. #include <type_traits>
  3.  
  4. template<typename T>
  5. struct enable_shared_from_that
  6. {
  7. // put a member here
  8. enable_shared_from_that()
  9. {
  10. static_assert(static_cast<enable_shared_from_that<T>*>((T*)0) == 0, "Not a public base of enable_shared_from_that");
  11. }
  12. };
  13.  
  14. struct X : /*private*/ enable_shared_from_that<X>
  15. {
  16. };
  17.  
  18. int main() {
  19. X x;
  20. }
  21.  
Success #stdin #stdout 0s 3464KB
stdin
Standard input is empty
stdout
Standard output is empty