diff --git a/README.md b/README.md index 8ab54c0..e131f6e 100644 --- a/README.md +++ b/README.md @@ -68,14 +68,15 @@ int main() X* pX = nullptr; // Begin - if (i == 0) - pX = new X0; - else if (i == 1) - pX = new X1; - else - pX = new X2; - - std::unique_ptr x{pX}; + X&& instance = + i == 0 ? (X&&)X0{} : + i == 1 ? (X&&)X1{} : + (X&&)X2{}; + + // we could get rid of ptrs and use normal calls + // instance.Process(); + + pX = &instance; // End pX->Process();