I don't get exactly if I am doing the right thing
template<typename ...AllVArgs>
auto dealloc_all(AllVArgs &..._AllVArgs) -> void {
(((std::cout << "\nin dealloc_all function " << &_AllVArgs), ...) << " ");
((delete _AllVArgs), ...);
((_AllVArgs), ...) = nullptr;
}
I allocated 2 struct and try to free them by using the variadic template function
struct a {
int x;
}
a *v1 = new a();
a *v2 = new a();
std::cout << "\nin a function " << &v1<< " " << &v2;
//address output = 0x1dce9ff588 0x1dce9ff580
dealloc_all(v1, v2);
I just wanted to know if I successfully free the allocated memory. btw these are the output it gives me, and I think there's no problem with it?
in a function 0xa4b89ff5c8 0xa4b89ff5c0
in dealloc_all function 0xa4b89ff5c8
in dealloc_all function 0xa4b89ff5c0