次の方法で共有


Members of Class Templates

OverviewHow Do I

Members of classes are defined slightly differently than those of nontemplated classes. Continuing the preceding example:

template <class T, int i>
    int TempClass< T, i >::MemberSet( T a, int b )
    {
        if( ( b >= 0 ) && (b < i) )
        {
           Tarray[b++] = a;
           return sizeof( a );
        }
        else
           return -1;
    }