#include <cstdio>

struct A
{
    A()
    :
    dummy(printf("Starting to construct A()\n"))
    {
    	printf("Fully constructed A()\n");
    }
    int dummy;
};

template <typename T>
struct Nesting;

template <>
struct Nesting<int>
{
	constexpr static int value = 0;
};

template <template <typename> class T, typename I>
struct Nesting<T<I>>
{
		constexpr static int value = 1 + Nesting<I>::value;
};

template<typename T>
struct B
{
    int dummy;
    A a;
    T b;
    B()
    :
    dummy(printf("Starting to construct B() with nesting %d\n", Nesting<B<T>>::value)),
    a(),
    b()
    {
    	printf("Fully constructed B() with nesting %d\n", Nesting<B<T>>::value);
    }
};

int main()
{
    B<B<B<int>>> Test;
    return 0;
}