#include <iostream>
#include <vector>
template <typename T> class Bar {};
template <typename C> struct get_template_type;
template <template <typename > class C, typename T>
struct get_template_type<C<T>>
{
using type = T;
};
template <typename T>
void someFunction()
{
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
template <typename C>
void test(const C& c)
{
for (auto& foo : c) {
someFunction<typename get_template_type<typename std::decay<decltype(foo)>::type>::type>();
}
}
int main() {
std::vector<Bar<int>> fs(1);
test(fs);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+IGNsYXNzIEJhciB7fTsKCnRlbXBsYXRlIDx0eXBlbmFtZSBDPiBzdHJ1Y3QgZ2V0X3RlbXBsYXRlX3R5cGU7Cgp0ZW1wbGF0ZSA8dGVtcGxhdGUgPHR5cGVuYW1lID4gY2xhc3MgQywgdHlwZW5hbWUgVD4Kc3RydWN0IGdldF90ZW1wbGF0ZV90eXBlPEM8VD4+CnsKICAgIHVzaW5nIHR5cGUgPSBUOwp9OwoKdGVtcGxhdGUgPHR5cGVuYW1lIFQ+CnZvaWQgc29tZUZ1bmN0aW9uKCkKewogICAgc3RkOjpjb3V0IDw8IF9fUFJFVFRZX0ZVTkNUSU9OX18gPDwgc3RkOjplbmRsOwp9Cgp0ZW1wbGF0ZSA8dHlwZW5hbWUgQz4Kdm9pZCB0ZXN0KGNvbnN0IEMmIGMpCnsKICAgIGZvciAoYXV0byYgZm9vIDogYykgewogICAgICAgIHNvbWVGdW5jdGlvbjx0eXBlbmFtZSBnZXRfdGVtcGxhdGVfdHlwZTx0eXBlbmFtZSBzdGQ6OmRlY2F5PGRlY2x0eXBlKGZvbyk+Ojp0eXBlPjo6dHlwZT4oKTsKICAgIH0KfQoKaW50IG1haW4oKSB7CiAgICBzdGQ6OnZlY3RvcjxCYXI8aW50Pj4gZnMoMSk7CgogICAgdGVzdChmcyk7Cn0K