C++98 스타일

template<class T> 
class MyAlloc
{
public:
		template<class U> 
		struct rebind
		{
				using other = MyAlloc<U>;
		};
};

template<class T> 
void foo(T ax)
{
		// 템플릿 의존적인 타입을 꺼내고 있기때문에 typename 명시 필요.
		// 의존적인 타입을 꺼내는게 다시 템플릿을 쓰고 있기 때문에 
		// rebind가 템플릿이라는것을 명시해준다.
		typename T::template rebind<int>::other ax2;
}

int main()
{
		MyAlloc<bool> ax;
		foo(ax);
}

C++11 이후 방법

// traits를 통해서 rebind를 할 수 있다.
typename std::allocator_traits<T>::template rebind_alloc<int> ax2;