15-10-2024, 09:58 AM
Hi!
I wonder if this code example technically violates A18-9-4?
Since internally, std::make_unique takes the input arguments as "Args&&..." and std::forward's them into the constructor of the class.
Thanks!
I wonder if this code example technically violates A18-9-4?
Code:
#include <memory>
struct Foo
{
explicit Foo(int);
};
int main()
{
int val{};
auto x = std::make_unique<Foo>(val);
++val; // non-compliant?
}
Since internally, std::make_unique takes the input arguments as "Args&&..." and std::forward's them into the constructor of the class.
Thanks!