@helios thanks for the response btw, and Merry Christmas!!!
I don't have any particular need to do this, apart from making code written a little more aesthetically pleasing, instead of having something like this:
#include <iostream>
#include <list>
#include <memory>
struct A { int v ; A( int i = 0 ) : v(i) {} ~A() { std::cout << "A::destructor - v == " << v << '\n' ; } };
int main()
{
{
std::list< std::unique_ptr<A> > lst ; // *** good: list of smart pointers
for( int i = 0 ; i < 5 ; ++i ) lst.push_back( std::make_unique<A>(i) ) ;
}
std::cout << '\n' ;
{
std::list<A*> lst2 ; // *** bad: list of owning raw pointers
for( int i = 5 ; i < 10 ; ++i ) lst2.push_back( new A(i) ) ;
for( auto p : lst2 ) delete p ;
}
}
@helios tbh I was just digging around the internet to see what interesting features of c++ I could find that could "spice up" my code, but now I understand why so many people dislike variadic functions. They're outdated!
@JLBorges I actually am using smart pointers in any implementation I use the ArrayList/LinkedList classes with, but for the purposes of sticking something into the template arguments for the class I stuck void* because it wasn't the objects inside I was worried about deleting, but rather just the encasing class which I wanted to delete. The actual lists had different POD types in them but not necessarily the same data types. I appreciate the reply though.
No, no one likes because they're massively unsafe, and using them requires getting a number of things right that the compiler can't verify, and if you screw up you end up corrupting the stack.