How to use generics types as params? I have two lists
list<XmlElement*>* childrens;
list<XmlAttribute*>* attributes;
I want transfer this variables as params to method, like this, but it isn't work
void method(list<void*>* l);
P.S. this code should use the minimum possible amount of memory, because microcontrollers has so little RAM.
May be template would do the trick ?
#include <iostream>
#include <list>
template <class T>
void foo (const std::list<T*>& v)
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
int main()
{
std::list<int*> v { nullptr, nullptr };
foo(v);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With