79505236

Date: 2025-03-13 01:59:59
Score: 1
Natty:
Report link

As Adam Nevraumont pointed out, std::unique_ptr<void*> wont work.

If you're using c++17, std::any is probably your best option.

This would replace std::unique<void> with std::unique<std::any>>. Keep in mind std::unique_ptr<void> won't compile without a lot of extra work.

Best options are:

  1. Use a raw pointer void*
  2. Use std::unique<std::any>> for smart pointer support + type safety

Resources on std::any

Questions related to std::any:

Reasons:
  • Blacklisted phrase (0.5): medium.com
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Caleb Burke