64,654
社区成员
发帖
与我相关
我的任务
分享
template<class T, size_t size = 1024>
class CC
{
//....
};
#include <iostream>
#include <typeinfo>
using namespace std;
template<class T, size_t size = 1024>
class CC
{
};
int main(int argc, char* argv[])
{
CC<int, 100> c1;
CC<int, 200> c2;
cout << typeid(c1).name() << endl;
cout << typeid(c2).name() << endl;
return 0;
}
2CCIiLm100EE
2CCIiLm200EE
template<class T, unsigned size = 1024>
class CC
{
public:
CC(){}
};
int main()
{
CC<int, 100> c1;
CC<int, 200> c2;
return 0;
}
.file "test.cpp"
.def ___main; .scl 2; .type 32; .endef
.text
.align 2
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
andl $-16, %esp
movl $0, %eax
addl $15, %eax
addl $15, %eax
shrl $4, %eax
sall $4, %eax
movl %eax, -8(%ebp)
movl -8(%ebp), %eax
call __alloca
call ___main
leal -1(%ebp), %eax
movl %eax, (%esp)
call __ZN2CCIiLj100EEC1Ev
leal -2(%ebp), %eax
movl %eax, (%esp)
call __ZN2CCIiLj200EEC1Ev
movl $0, %eax
leave
ret
.section .text$_ZN2CCIiLj100EEC1Ev,"x"
.linkonce discard
.align 2
.globl __ZN2CCIiLj100EEC1Ev
.def __ZN2CCIiLj100EEC1Ev; .scl 2; .type 32; .endef
__ZN2CCIiLj100EEC1Ev: ; CC<int, 100> 的构造函数
pushl %ebp
movl %esp, %ebp
popl %ebp
ret
.section .text$_ZN2CCIiLj200EEC1Ev,"x"
.linkonce discard
.align 2
.globl __ZN2CCIiLj200EEC1Ev ; CC<int, 200> 的构造函数
.def __ZN2CCIiLj200EEC1Ev; .scl 2; .type 32; .endef
__ZN2CCIiLj200EEC1Ev:
pushl %ebp
movl %esp, %ebp
popl %ebp
ret
.def __ZN2CCIiLj200EEC1Ev; .scl 3; .type 32; .endef
.def __ZN2CCIiLj100EEC1Ev; .scl 3; .type 32; .endef