1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:17:44 +00:00

NeverDestroyed: Add tests

Problem:
- It is difficult to refactor because there are no tests to bind the
functionality.
- Arguments are not forwarded correctly to the constructor.

Solution:
- Add tests.
- Change constructor to take forwarding references.
This commit is contained in:
Lenny Maiorani 2020-11-21 17:23:17 -07:00 committed by Andreas Kling
parent bc5b8223b7
commit 840c3b501d
2 changed files with 96 additions and 1 deletions

View file

@ -38,7 +38,7 @@ class NeverDestroyed {
public:
template<typename... Args>
NeverDestroyed(Args... args)
NeverDestroyed(Args&&... args)
{
new (storage) T(forward<Args>(args)...);
}