fork download
  1. #include <iostream>
  2. using std::cout;
  3. using std::endl;
  4.  
  5. struct dummy{};
  6.  
  7. struct BigInt {
  8. BigInt( const dummy & ) {}
  9. BigInt() {
  10. cout << __PRETTY_FUNCTION__ << " : very very long operation"<< endl;
  11. }
  12. BigInt( const BigInt & ) {
  13. cout << __PRETTY_FUNCTION__ << " : very very long operation"<< endl;
  14. }
  15. BigInt & operator=( const BigInt & ) {
  16. cout << __PRETTY_FUNCTION__ << " : very very long operation"<< endl;
  17. return *this;
  18. }
  19. };
  20.  
  21. struct Foo {
  22. BigInt i;
  23. Foo( const BigInt & j ) {
  24. i = j;
  25. }
  26. };
  27.  
  28. struct Bar {
  29. BigInt i;
  30. Bar( const BigInt & j ) : i( j ) {}
  31. };
  32.  
  33. int main() {
  34. BigInt bi( (dummy()) );
  35. Foo foo( bi );
  36. Bar bar( bi );
  37. }
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
BigInt::BigInt() : very very long operation
BigInt& BigInt::operator=(const BigInt&) : very very long operation
BigInt::BigInt(const BigInt&) : very very long operation