IT戦記

プログラミング、起業などについて書いているプログラマーのブログです😚

テンプレートのメンバ関数がインスタンス化される箇所

以下のエントリで色々と勉強になりました

クラステンプレートの具現化の位置 - hattorix0の日記
ありがとうございます!

重要なのは以下の箇所

For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template, if the specialization is implicitly instantiated because it is referenced from within another template specialization and the context from which it is referenced depends on a template parameter, the point of instantiation of the specialization is the point of instantiation of the enclosing specialization. Otherwise, the point of instantiation for such a specialization immediately follows the namespace scope declaration or definition that refers to the specialization.

http://www.kuzbass.ru:8086/docs/isocpp/template.html#temp.point

ただ、この文章

For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template
    - if the specialization is implicitly instantiated because it is referenced from within another template specialization and the context from which it is referenced depends on a template parameter, the point of instantiation of the specialization is the point of instantiation of the enclosing specialization.
    - Otherwise, the point of instantiation for such a specialization immediately follows the namespace scope declaration or definition that refers to the specialization. 

という意味なのか

    - For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template, if the specialization is implicitly instantiated because it is referenced from within another template specialization and the context from which it is referenced depends on a template parameter, the point of instantiation of the specialization is the point of instantiation of the enclosing specialization. 
    - Otherwise, the point of instantiation for such a specialization immediately follows the namespace scope declaration or definition that refers to the specialization. 

という意味なのか

For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template

の文が、最初の文章だけにかかるのか、段落全体にかかるのか、が分からない。
その後に続く文章の感じからすると後者かなあ。
あ、ひょっとして

such a specialization

ってのが

For a function template specialization, a member function template specialization, or a specialization for a member function or static data member of a class template

のことなのか!なるほど!
such! such!