C++ Built-In Array??????
???????????? ???????[ 2014/11/18 16:06:22 ] ??????????????? C++ .NET
????C++ ??????????????????class????????primitive types?????÷?????????array??????
????A a[100]??// A is class
????int b[100]??
???????a???????????????????????????????????array????????????????????????????
????A ??POD?????????????????
???????A???????????POD???μ????????????????http://www.cnblogs.com/ly8838/p/3929025.html ???????????A ????????д????????????κβ???????????????в??
??????????A a[3] ???? A a1?? a2??a3?? ??????????????????????????????????
????A ????????????????????destructor??????
?????????????????struct??
struct StackObject
{
int _a;
int _b;
StackObject(): _a(0)?? _b(1)
{
}
};
?????????????????
void TestArraySemantics()
{
StackObject sa[10]; //line 1??call vector constructor iterator
sa[0]._a= 1;
sa[9]._b = 10;
}
??????VC++2010????????????????line1???????????????????????????????“???????????vector constructor iterator??”:
????????????????£?
void Vector_constructor_iterator(
int array_size??
int array_element_size??
void (*Ctr)(void *addr)??
char *arrayStartAddress)
{
for(int i = 0; i < array_size; ++i)
{
void *objAddr = arrayStartAddress + i * array_element_size;
Ctr(objAddr);
}
}
???????????????? C ?????????? StackObject ???????????????????е??á?
????????????????????????A a[3]?? ??A a1??a2?? a3?? ?????巢????????仯?????????????????????????????????????????StackObject??????????????????????array?????array??“????”????????30%???????array????ü????????????????????????????
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11