fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void *allocateSpaceAndUses() {
  5. return malloc(42); // Made up
  6. }
  7.  
  8. class SelectInst
  9. {
  10. public:
  11. int x;
  12. };
  13.  
  14. void *operator new(size_t Size, unsigned Us) {
  15. return allocateSpaceAndUses(); // Allocates enough space for Size and for Us uses
  16. }
  17.  
  18. SelectInst *Create() {
  19. return new(3) SelectInst();
  20. }
  21.  
  22. int main()
  23. {
  24. auto ptr = Create();
  25. return 0;
  26. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty