Index: BasicCompiler_Common/Class.cpp
===================================================================
--- BasicCompiler_Common/Class.cpp	(revision 139)
+++ BasicCompiler_Common/Class.cpp	(revision 140)
@@ -15,5 +15,6 @@
 
 CClass::CClass( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name )
-	: Prototype( namespaceScopes, name )
+	: isReady( false )
+	, Prototype( namespaceScopes, name )
 	, importedNamespaces( importedNamespaces )
 	, ConstructorMemberSubIndex( 0 )
@@ -21,6 +22,4 @@
 	, classType( Class )
 	, pobj_InheritsClass( NULL )
-	, ppobj_Member( NULL )
-	, iMemberNum( 0 )
 	, vtbl_num( 0 )
 	, iAlign( 0 )
@@ -32,16 +31,10 @@
 }
 CClass::~CClass(){
-	int i;
-
-	if(ppobj_Member){
-		//メンバ
-		for(i=0;i<iMemberNum;i++){
-			delete ppobj_Member[i];
-		}
-		HeapDefaultFree(ppobj_Member);
-		ppobj_Member=0;
-	}
-
-	//静的メンバ
+	// 動的メンバ
+	foreach( CMember *member, dynamicMembers ){
+		delete member;
+	}
+
+	// 静的メンバ
 	foreach( CMember *member, staticMembers ){
 		delete member;
@@ -149,5 +142,5 @@
 	}
 
-	if( inheritsClass.ppobj_Member == 0 ){
+	if( !inheritsClass.IsReady() ){
 		//継承先が読み取られていないとき
 		pobj_LoopRefCheck->add(this->GetName().c_str());
@@ -157,21 +150,16 @@
 
 	//メンバをコピー
-	ppobj_Member=(CMember **)HeapReAlloc(
-		hHeap,
-		0,
-		ppobj_Member,
-		( iMemberNum + inheritsClass.iMemberNum )*sizeof(CMember *));
-	for(int i3=0;i3<inheritsClass.iMemberNum;i3++){
-		ppobj_Member[iMemberNum]=new CMember( *inheritsClass.ppobj_Member[i3] );
+	BOOST_FOREACH( CMember *inheritsClassDynamicMember, inheritsClass.dynamicMembers ){
+		CMember *pMember = new CMember( *inheritsClassDynamicMember );
 
 		// アクセシビリティ
-		if( inheritsClass.ppobj_Member[i3]->IsPrivate() ){
-			ppobj_Member[iMemberNum]->SetAccessibility( Prototype::None );
+		if( inheritsClassDynamicMember->IsPrivate() ){
+			pMember->SetAccessibility( Prototype::None );
 		}
 		else{
-			ppobj_Member[iMemberNum]->SetAccessibility( inheritsClass.ppobj_Member[i3]->GetAccessibility() );
-		}
-
-		iMemberNum++;
+			pMember->SetAccessibility( inheritsClassDynamicMember->GetAccessibility() );
+		}
+
+		dynamicMembers.push_back( pMember );
 	}
 
@@ -216,5 +204,5 @@
 	}
 
-	if( inheritsInterface.ppobj_Member == 0 ){
+	if( !inheritsInterface.IsReady() ){
 		//継承先が読み取られていないとき
 		pobj_LoopRefCheck->add(this->GetName().c_str());
@@ -255,11 +243,10 @@
 }
 void CClass::AddMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer ){
-	ppobj_Member = (CMember **)HeapReAlloc( hHeap, 0, ppobj_Member, ( iMemberNum + 1 ) * sizeof(CMember *) );
-	ppobj_Member[iMemberNum] = new CMember( this, accessibility, isConst, isRef, buffer );
-	iMemberNum++;
+	CMember *pMember = new CMember( this, accessibility, isConst, isRef, buffer );
+	dynamicMembers.push_back( pMember );
 }
 void CClass::AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){
-	CMember *member = new CMember( this, accessibility, isConst, isRef, buffer, nowLine );
-	staticMembers.push_back( member );
+	CMember *pMember = new CMember( this, accessibility, isConst, isRef, buffer, nowLine );
+	staticMembers.push_back( pMember );
 }
 BOOL CClass::DupliCheckAll(const char *name){
@@ -281,14 +268,14 @@
 	//重複チェック
 
-	//メンバ
-	for( int i=0;i<iMemberNum;i++){
-		if( GetName() == ppobj_Member[i]->GetName() ){
+	// 動的メンバ
+	BOOST_FOREACH( CMember *pMember, dynamicMembers ){
+		if( GetName() == pMember->GetName() ){
 			return 1;
 		}
 	}
 
-	//静的メンバ
-	foreach( CMember *member, staticMembers ){
-		if( GetName() == member->GetName() ){
+	// 静的メンバ
+	foreach( CMember *pMember, staticMembers ){
+		if( GetName() == pMember->GetName() ){
 			return 1;
 		}
@@ -321,5 +308,5 @@
 int CClass::GetMemberOffset( const char *memberName, int *pMemberNum ) const
 {
-	int i,i2,offset;
+	int i2,offset;
 
 	//仮想関数が存在する場合は関数リストへのポインタのサイズを追加
@@ -332,6 +319,7 @@
 
 	int iMaxAlign=0;
-	for(i=0;i<iMemberNum;i++){
-		CMember *pMember = ppobj_Member[i];
+	int i = -1;
+	BOOST_FOREACH( CMember *pMember, dynamicMembers ){
+		i++;
 
 		i2 = pMember->GetType().GetSize();
@@ -393,5 +381,4 @@
 int CClass::GetAlignment() const
 {
-	int i;
 	int alignment,member_size;
 
@@ -399,7 +386,5 @@
 	else alignment=0;
 
-	for(i=0;i<iMemberNum;i++){
-		CMember *pMember = ppobj_Member[i];
-
+	BOOST_FOREACH( CMember *pMember, dynamicMembers ){
 		if(pMember->GetType().IsStruct()){
 			//メンバクラスのアラインメントを取得
@@ -969,7 +954,6 @@
 
 BOOL CDBClass::MemberVar_LoopRefCheck(const CClass &objClass){
-	int i,i2,bRet=1;
-	for(i=0;i<objClass.iMemberNum;i++){
-		const CMember *pMember = objClass.ppobj_Member[i];
+	int i2,bRet=1;
+	BOOST_FOREACH( CMember *pMember, objClass.dynamicMembers ){
 		if(pMember->GetType().IsStruct()){
 			//循環参照でないかをチェック
@@ -1055,12 +1039,10 @@
 			}
 
-			if(pobj_c->ppobj_Member){
+			if(pobj_c->IsReady()){
 				//既に先読みされているとき
 				continue;
 			}
 
-			//メンバ用メモリを初期化
-			pobj_c->ppobj_Member=(CMember **)HeapAlloc(hHeap,0,1);
-			pobj_c->iMemberNum=0;
+			pobj_c->Readed();
 
 			pobj_c->ConstructorMemberSubIndex=-1;
@@ -1206,5 +1188,5 @@
 			}
 
-			if(pobj_c->ppobj_Member){
+			if(pobj_c->IsReady()){
 				//既に先読みされているとき
 				continue;
@@ -1213,7 +1195,5 @@
 			pobj_c->iAlign=iAlign;
 
-			//メンバ用メモリを初期化
-			pobj_c->ppobj_Member=(CMember **)HeapAlloc(hHeap,0,1);
-			pobj_c->iMemberNum=0;
+			pobj_c->Readed();
 
 			pobj_c->ConstructorMemberSubIndex=-1;
@@ -1381,18 +1361,18 @@
 
 
-						if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){
-							if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().ppobj_Member==0){
+						if(pobj_c->dynamicMembers[pobj_c->dynamicMembers.size()-1]->GetType().IsStruct()){
+							if( !pobj_c->dynamicMembers[pobj_c->dynamicMembers.size()-1]->GetType().GetClass().IsReady() ){
 								//参照先が読み取られていないとき
-								GetClass_recur(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass().GetName().c_str());
+								GetClass_recur(pobj_c->dynamicMembers[pobj_c->dynamicMembers.size()-1]->GetType().GetClass().GetName().c_str());
 							}
 						}
 
 
-						if(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().IsStruct()){
+						if(pobj_c->dynamicMembers[pobj_c->dynamicMembers.size()-1]->GetType().IsStruct()){
 							//循環参照のチェック
 							pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
-							if(!MemberVar_LoopRefCheck(pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().GetClass())){
+							if(!MemberVar_LoopRefCheck(pobj_c->dynamicMembers[pobj_c->dynamicMembers.size()-1]->GetType().GetClass())){
 								//エラー回避
-								pobj_c->ppobj_Member[pobj_c->iMemberNum-1]->GetType().SetBasicType( DEF_PTR_VOID );
+								pobj_c->dynamicMembers[pobj_c->dynamicMembers.size()-1]->GetType().SetBasicType( DEF_PTR_VOID );
 							}
 							pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
@@ -1481,8 +1461,6 @@
 		char referenceOffsetsBuffer[1024] = "";
 		int numOfReference = 0;
-		for( int i=0; i<objClass.iMemberNum; i++ ){
-			CMember &member = *objClass.ppobj_Member[i];
-
-			if( member.GetType().IsObject() || member.GetType().IsPointer() ){
+		BOOST_FOREACH( CMember *pMember, objClass.dynamicMembers ){
+			if( pMember->GetType().IsObject() || pMember->GetType().IsPointer() ){
 				if( referenceOffsetsBuffer[0] ){
 					lstrcat( referenceOffsetsBuffer, "," );
@@ -1491,5 +1469,5 @@
 				sprintf( referenceOffsetsBuffer + lstrlen( referenceOffsetsBuffer ),
 					"%d",
-					objClass.GetMemberOffset( member.GetName().c_str() ) );
+					objClass.GetMemberOffset( pMember->GetName().c_str() ) );
 
 				numOfReference++;
