What will be printed out as a result of the following code execution?
#include <iostream>

struct A
{
    struct B
    {
        int value;
    } b;
};

template<typename T>
void func(typename T::B b)
{
    std::cout << b.value;
}

int main(int argc, char * argv[])
{
    A a = {{5}};
    func(a.b);
}
Explanation
The parameter of the template should be specified explicitly: func<A>(a.b)

Следи за CodeGalaxy

Мобильное приложение Beta

Get it on Google Play
Обратная Связь
Cosmo
Зарегистрируйся сейчас
или Подпишись на будущие тесты