fork download
  1. #include <memory>
  2. #include <vector>
  3.  
  4. typedef int DWORD;
  5. struct CD3DFont {
  6. CD3DFont(const char * szFontName,int FontHeight,DWORD dwCreateFlags){}
  7. void Initialize(char){}
  8. void Invalidate(){}
  9. };
  10. const static char origIDirect3DDevice9='0';
  11.  
  12.  
  13.  
  14.  
  15. struct CD3DInvalidator {
  16. template<class T>
  17. void operator()(T* ptr) const {
  18. ptr->Invalidate();
  19. delete ptr;
  20. }
  21. };
  22. typedef std::unique_ptr<CD3DFont, CD3DInvalidator> font_ptr;
  23. font_ptr TextCreate(const char * szFontName,int FontHeight,DWORD dwCreateFlags)
  24. {
  25. CD3DFont* ptr = new CD3DFont(szFontName,FontHeight,dwCreateFlags);
  26. ptr->Initialize(origIDirect3DDevice9);
  27. return font_ptr(ptr);
  28. }
  29.  
  30. int main() {
  31. std::vector<font_ptr> fonts;
  32. fonts.push_back(TextCreate("thing", 43124, 0));
  33. }
Success #stdin #stdout 0s 3012KB
stdin
Standard input is empty
stdout
Standard output is empty