怎么理解"Point of Instantiation"的意思

How can I understand the meaning of "Point of Instantiation"

我现在正在向non-constant-constant-expressions学习一些元编程技巧,我对"Point of Instantiation"感到困惑。作者说

Whenever a template specialization is referenced in a context that requires instantiation, that context gives birth to a "point of instantiation" (which effectively denotes a location where the compiler is allowed to generate code for the referenced template specialization).

If a template specialization X is referenced in a context that depends on a template-parameter of some surrounding template Y, the given point of instantation depends on the point of instantation of Y.

  • If X is a function template specialization, the point of instantiation is that of Y.
  • If X is a class template specialization, the point of instantiation is immediately before the point of instantiation of Y.

Otherwise, the given point of instantiation is tied to the location of the namespace scope declaration/definition (D) which contains the statement referring to X.

  • If X is a function template specialization, the point of instantiation is immediately after D.
  • If X is a class template specialization, the point of instantiation is immediately before D.

我不知道"a template specialization X is referenced in a context that depends on a template-parameter of some surrounding template Y"是什么意思,他是什么意思

template<typename T>
class Y{
    template<typename U1> void X1(){...};
    template<typename U2> class X2{...};
}

考虑 Y<int>::X1<int>(...)X1Y 同时实例化。

首先考虑 Y<int>::X2<int>{...}X2 Y 第二。

就是说,给定

template<class> class A {};
template<class T> void f(T) {}
template<class T> void g() {f(A<T>{});}

(比如)A<int> 的实例化点紧接在 f<int>g<int> 共享的实例化点之前。 (请记住,函数(但不是 class)模板在翻译单元中可以有 more than one point of instantiation。)