fork(1) download
  1. #include <string>
  2. #include <memory>
  3.  
  4. template<typename T>
  5. class Base {
  6. public:
  7. template<typename... Args >
  8. static std::shared_ptr<T> create(Args&&... args) {
  9. return std::make_shared<T>(std::forward<Args>(args)...);
  10. }
  11. };
  12.  
  13. class Derived : public Base<Derived> {
  14. public:
  15. Derived(const std::string &str, int i) {}
  16. };
  17.  
  18. int main() {
  19. auto derived = Derived::create("text", 123);
  20. }
Success #stdin #stdout 0s 3268KB
stdin
Standard input is empty
stdout
Standard output is empty