○注意:
ここらへんにあるデータ結果はほとんどナンセンスなものばっかりです。
インライン関数とマクロがどっちが速いか!?とかいう馬鹿なことやってます^^;



■クラスの開放順序(クラス内部に内部にクラスオブジェクト?がある時
日時:10:16 2003/10/05
結果:
GO
local initialized.
MAIN initialized.
MAIN uninitialized.
local uninitialized.

#include <stdio.h>
struct local{
	local(){printf("local initialized.\n");}
	~local(){printf("local uninitialized.\n");}
};
struct MAIN{
	local l;
	MAIN(){
		printf("MAIN initialized.\n");
	}
	~MAIN(){printf("MAIN uninitialized.\n");}
};

int main(){
	printf("GO\n");
	MAIN main;


	return 0;
}





■std::list<T>のちょっと変わった使い方
日時:23:06 2003/07/26
結果:メモリに数バイト無駄があります。

#include <stdio.h>
//#include <glib.h>
#include <list>
#include <windows.h>
//#pragma comment(lib,"glib-2.0.lib")

class Obj : public std::list<Obj>{
protected:
	int var;
public:
	Obj(){}
	virtual ~Obj(){}
	void print(){printf("var = %d\n",var);}
	void set_var(int v){var=v;}

};

const int loopnum = 100;
void main(){
	Obj o,temp;
	for(int i=0;i<loopnum;i++){
		temp.set_var(i);
		o.push_back(temp);
	}
	temp.
	for(Obj::iterator it=o.begin();it != o.end(); it++){
		(*it).print();
	}
	Sleep(50000);
}






■現在時刻を得るとか、newのオーバーロードとか
日時:11:16 2003/05/31
結果:大丈夫そうです。

#include <crtdbg.h>

#define _CRTDBG_MAP_ALLOC

#include <stdio.h>
#include <windows.h>
//#include <deque>
//#include "dKingyoUtility.h"


typedef struct tugGetPower_{
}tugGetPower;


inline void *operator new(size_t get,tugGetPower //power
													)
{
	return malloc(get);
}

static void operator delete[](void* obj,tugGetPower// power
													)
{
	free(obj);
}

inline void *operator new[](size_t get,tugGetPower //power
													)
{
	return malloc(get);
}

static void operator delete(void* obj,tugGetPower// power
													)
{
	free(obj);
}

class CWrapper{
public:
	CWrapper(){}
	~CWrapper(){}
	static tugGetPower m_new; 
	static void *operator new(size_t size);//cppファイルにこれを実装してください。

//かなりナンセンスゥな実装だなぁ^^;プリプロセッサはグローバルだしいっか^^
#	define DNEW new(CWrapper::m_new)
#	define DDELETE(del) ::operator delete[](del,CWrapper::m_new)
};

tugGetPower CWrapper::m_new;

void GetCharOfSystemTimeUpToMinute(char *buff,size_t buffsize)
{
	SYSTEMTIME lpSystemTime={0};
	GetSystemTime(
		&lpSystemTime   // address of system time structure
	);
	_snprintf(buff,buffsize,"%d:%d %d/%d/%d",
		lpSystemTime.wHour,
		lpSystemTime.wMinute,
		lpSystemTime.wYear,
		lpSystemTime.wMonth,
		lpSystemTime.wDay
		);
		//10:47 2003/05/31
}
void GetCharOfMemoPadTypeTime(char *buff,size_t buffsize){
	GetCharOfSystemTimeUpToMinute(buff,buffsize);
}

void GetCharOfSystemTimeAll(char *buff,size_t buffsize)
{
	SYSTEMTIME lpSystemTime={0};
	GetSystemTime(
		&lpSystemTime   // address of system time structure
	);
	LPSTR lpszDayOfWeek;
	//曜日文字列の作成
  switch (lpSystemTime.wDayOfWeek){
  case 0: lpszDayOfWeek = "Sun";   break;
  case 1: lpszDayOfWeek = "Mon";   break;
  case 2: lpszDayOfWeek = "Tue";   break;
  case 3: lpszDayOfWeek = "Wed";   break;
  case 4: lpszDayOfWeek = "Thu";   break;
  case 5: lpszDayOfWeek = "Fri";   break;
  case 6: lpszDayOfWeek = "Sat";   break;
  }   // 曜日文字列の作成
	_snprintf(buff,buffsize,"%d:%d:%d.%d %d/%d/%d/%s",
		lpSystemTime.wHour,
		lpSystemTime.wMinute,
		lpSystemTime.wSecond,
		lpSystemTime.wMilliseconds,
		lpSystemTime.wYear,
		lpSystemTime.wMonth,
		lpSystemTime.wDay,
		lpszDayOfWeek
		);
}

void GetCharOfLocalTimeAllJapanese(char *buff,size_t buffsize){
  SYSTEMTIME  time;           //時刻
  LPCSTR      lpszDayOfWeek;  //曜日

  //ローカル時間の取得
  GetLocalTime (&time);

  //曜日文字列の作成
  switch (time.wDayOfWeek){
  case 0: lpszDayOfWeek = "日";   break;
  case 1: lpszDayOfWeek = "月";   break;
  case 2: lpszDayOfWeek = "火";   break;
  case 3: lpszDayOfWeek = "水";   break;
  case 4: lpszDayOfWeek = "木";   break;
  case 5: lpszDayOfWeek = "金";   break;
  case 6: lpszDayOfWeek = "土";   break;
  }   // 曜日文字列の作成

  //文字列の書式か
  _snprintf(buff,buffsize,"%d年%d月%d日(%s曜日) %d時%d分%d.%d秒",
      time.wYear, time.wMonth, time.wDay, lpszDayOfWeek,
      time.wHour, time.wMinute, time.wSecond, time.wMilliseconds
  );

}

void main(){
	const int multi_sleep=5;
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	tugGetPower power;

	char *p=DNEW char[100]; 
	GetCharOfSystemTimeUpToMinute(p,100);
	printf(p);
	printf("\n");
	GetCharOfLocalTimeAllJapanese(p,100);
	printf(p);
	printf("\n");
	GetCharOfSystemTimeAll(p,100);
	printf(p);
	DDELETE(p);
	

	Sleep(1000 * multi_sleep);

}


//**********************************************************


■抽象クラスでもデストラクタは呼ばれるか?
日時:
17:37 2003/04/19
結果:
見事に呼ばれるようです。


以下がソース。

#include <crtdbg.h>

#define _CRTDBG_MAP_ALLOC
//サンプル.Microsoftコンパイラ版
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windows.h>
//#include <varargs.h>
//サンプル.
#include <stdio.h>
#include <string.h>

class Ic{
public:
	Ic(){}
	virtual ~Ic(){printf("抽象が呼ばれた\n");}
	virtual run() = 0;
};
class c : public Ic{
public:
	c(){}
	virtual ~c(){printf("これはc\n");}
	virtual run(){printf("よんだよ!\n");}
};
void main(){
	Ic *p = new c;
	p->run();
	delete p;
	Sleep(3000);
}




■クラスを何重にも継承させたらどう動くのよ!?

日時:17:38 2003/04/19

結果:
抽象コンストラクタ
これはcのコンストラクタ
c2コンストラクタ
c2がよんだよ!
これはc2のデストラクタ
これはcのデストラクタ
抽象デストラクタ

以下がソース。
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windows.h>
//#include <varargs.h>
//サンプル.
#include <stdio.h>
#include <string.h>

class Ic{
public:
	Ic(){printf("抽象コンストラクタ\n");}
	virtual ~Ic(){printf("抽象デストラクタ\n");}
	virtual run() = 0;
};
class c : public Ic{
public:
	c(){printf("これはcのコンストラクタ\n");}
	virtual ~c(){printf("これはcのデストラクタ\n");}
	virtual run(){printf("cがよんだよ!\n");}
};
class c2 : public c{
public:
	c2(){printf("c2コンストラクタ");}
	virtual ~c2(){printf("これはc2のデストラクタ\n");}
	virtual run(){printf("c2がよんだよ!\n");}
};
void main(){
	Ic *p = new c2;
	p->run();
	delete p;
	Sleep(5000);
}



■コンストラクタで仮想関数呼んだらどうなるのよ!

日時:17:45 2003/04/19
結果:
抽象コンストラクタ
これはcのコンストラクタ
cがよんだよ!
c2コンストラクタ
c2がよんだよ!
c2がよんだよ!
これはc2のデストラクタ
これはcのデストラクタ
抽象デストラクタ

以下がソース


#include <io.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windows.h>
//#include <varargs.h>
//サンプル.
#include <stdio.h>
#include <string.h>

class Ic{
public:
	Ic(){printf("抽象コンストラクタ\n");}
	virtual ~Ic(){printf("抽象デストラクタ\n");}
	virtual run() = 0;
};
class c : public Ic{
public:
	c(){printf("これはcのコンストラクタ\n");run();}
	virtual ~c(){printf("これはcのデストラクタ\n");}
	virtual run(){printf("cがよんだよ!\n");}
};
class c2 : public c{
public:
	c2(){printf("c2コンストラクタ\n");run();}
	virtual ~c2(){printf("これはc2のデストラクタ\n");}
	virtual run(){printf("c2がよんだよ!\n");}
};
void main(){
	Ic *p = new c2;
	p->run();
	delete p;
	Sleep(5000);
}


■コンストラクタでメモリ確保したクラスはしっかりそのメモリを開放できるか?
日時:18:05 2003/04/19
結果:
基底クラスの方が開放できてないようです。
Detected memory leaks!
Dumping objects ->
{45} normal block at 0x00341048, 100 bytes long.
 Data: <                > CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD CD 
Object dump complete.

以下がソース

#include <crtdbg.h>
#define _CRTDBG_MAP_ALLOC
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>

class Im{
protected:
	char *mem;
public:
	Im(size_t s=100){
		mem=NULL;
		mem_malloc(s);
	}
	virtual void mem_malloc(size_t size){
		mem = (char *)malloc(size);
	}
	virtual ~Im(){
		if(mem){
			free(mem);mem=NULL;
		}
	}
};

class m : public Im{
public:
	m(size_t s=50){
		mem=NULL;
		mem_malloc(s);
	}
	virtual void mem_malloc(size_t size){
		mem = (char *)malloc(size);
		strncpy(mem,"OK",size);
		printf(mem);
	}
	/* //このコメントアウトをはずそうがなにしようがメモリリークする。
	virtual ~m(){
		if(mem){
			free(mem);mem=NULL;
		}
	}*/

};
void main(){
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	Im *p= new m;
	delete p;
}



正当:
/**
18:15 2003/04/19
基底クラスが初期化や開放(コンストラクタ、デストラクタ)をすべて受け持っている場合
オーバーライドはやってはいけない。また、コンストラクタやデストラクタに入っている関数も
基底クラスの関数を実行するので注意したほうがいい。
かといって、基底クラスのコンストラクタで呼び出されている関数を以下のようにすると、
virtual void mem_malloc(size_t size) = 0;

dos.obj : error LNK2001: 外部シンボル ""public: virtual void __thiscall Im::mem_malloc(unsigned int)" (?mem_malloc@Im@@UAEXI@Z)" は未解決です
Debug/dos.exe : fatal error LNK1120: 外部参照 1 が未解決です。

のようになってしまうようだ。
もしかしたらもっとよい方法があるのだろう!!
その前にデザパタ勉強せんと〜〜。
*/

class Im{
protected:
	char *mem;
public:
	Im(size_t s=100){
		mem=NULL;
		mem_malloc(s);
	}
	virtual void mem_malloc(size_t size){
		mem = (char *)malloc(size);
	}
	virtual ~Im(){
		if(mem){
			free(mem);mem=NULL;
		}
	}
};

class m : public Im{
public:
	m(size_t s=50){}//ほとんど意味なしやなぁ。

};
void main(){
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
	Im *p= new m;
	delete p;
}

■参照渡しってよく分からなかったけどこういう感じらしい。
日時:23:13 2003/04/19
結果:
こんなかんじ!?



#include <crtdbg.h>
#define _CRTDBG_MAP_ALLOC
#include <io.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <math.h>

#include <queue>
#include <deque>
#include <iostream>
using namespace std;

class t{
public:
	t(){i=100;}
	int i;
};

t gett(){
	t l;
	return l;
}

class c{
	t re;
public:
	c(t &g){re=g;}
	acc(){printf("%d \n",re.i);}
};

void main(){
	_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);

	int i;
	c set(gett());
	set.acc();
	Sleep(3000);
}



■std::listって気をつけないとだめらしい
日時:22:18 2003/04/26
結果:これをコンパイルして実行するとエラー。

//いろんなものをインクルード
#include <stdio.h>
#include <windows.h>
#include <deque>
#include <map>

#pragma comment(lib,"winmm")

//#include <boost/pool/pool.hpp>
//#include <boost/pool/object_pool.hpp>
#include <list>


//プロトタイプ関数
void print(char *str,...);
bool dKingyoAddLog( char *filename,char *str , ... );

typedef struct tug{
	tug(int n,bool f) : num(n),flag(f){}
	int num;
	bool flag;
}TUG;

int main(){
	typedef list<tug> LIST;
	LIST l;
	LIST::iterator it;
	int i=0;
	for(i=0;i<10;i++){
		l.push_back(TUG(i,true));
	}
	it = l.begin();
	while(it!=l.end())
	{
		it++;
		l.erase(it);
		printf("%d",(*it).num);
	}

	
	Sleep(3000);
	return 0;
}


void print(char *str,...){
	char s[512];
	va_list VaList;
	va_start( VaList , str ) ;
	vsprintf( s , str , VaList ) ;
	va_end( VaList ) ;
	dKingyoAddLog("Log.txt",s);
}


bool dKingyoAddLog( char *filename,char *str , ... )
{
	static FILE *fp=NULL;
	fp=NULL;
	static char s[1024];
	static va_list VaList ;
	memset((void *)s,NULL,sizeof(char)*1024);
	va_start( VaList , str ) ;
	vsprintf( s , str , VaList ) ;
	va_end( VaList ) ;
	if(s[strlen(s)-1] != '\n'){
		//最後の文字列に\nを入れる
		strcat(s,"\n");
	}
	if(NULL != (fp = fopen( filename , "at" ))){
		fputs( s , fp ) ;
		printf(s);
		fclose( fp ) ;
	}else{
			return false;
	}
	return true;
}


■どのメモリ確保関数が高速か!?
日時:23:18 2003/04/26
結果:boostのobject_poolが最速らしい。

ソース:欲しい方には差し上げます。
(他のいろんなライブラリを使用しているため転載によるトラブルを避けるためです。

使用ライブラリ:
boost : http://boost.org/
yaneSDK3rd yaneAllocator: http://www.sun-inet.or.jp/~yaneurao/
BoehmGC : http://www.hpl.hp.com/personal/Hans_Boehm/gc/

dKingyoVectorMemory : dKingyoUtillity ( dKingyoUtilClass) の一部。
メモリを完全なベクトル化にしてコンパクションをサポートする。


DEBUG build(最適化なしで計測);
boost::object_pool allocate time is 341 
yaneAllocator allocate time is 22332 
malloc allocate time is 300 
GC_malloc allocate time is 401 
dKingyoVectorMemory allocate time is 2814 


RELEASE build;(速度重視最適化で計測)
boost::object_pool allocate time is 230 
yaneAllocator allocate time is 1882 
malloc allocate time is 260 
GC_malloc allocate time is 391 
dKingyoVectorMemory allocate time is 1652 


■配列の中身を返す時添え字をc++とインクリメントするとどこの値を返すか?
日時:9:42 2003/04/27
結果:1を返しました。

ソース:

#include <stdio.h>
#include <windows.h>

int Get(){
	static int c=0;
	static int a[3]={1,2,3};
	return a[c++];
}

int main(){
	printf("%d",Get());
	Sleep(3000);
	return 0;
}

■抽象クラスにするとどのくらい遅くなるか?
日時:18:20 2003/04/27
結果:
軽い処理
0.04 s 抽象クラス
0.02 s そのまんま
tyu =44 
tyu3 =12 

重い処理
0.49 s 抽象クラス
0.52 s そのまんま
tyu =498 
tyu3 =473 

重い処理はRun関数内をprintf("");に置き換えたものです。

結論:
よって、今の時代はあまり気にしなくてよし!!!

ソース:
//軽い処理
#include <stdio.h>
#include <windows.h>
#include <deque>
#include <map>
#pragma comment(lib,"winmm")
#define __WIN32__
#include <boost/pool/pool.hpp>
#include <boost/pool/object_pool.hpp>
#include <boost/progress.hpp>
#include <list>
#include <malloc.h>

#define LOOPNUM 10000000
class tyu{//抽象クラス
public:
	int plus;
	virtual ~tyu(){}
	virtual void Run() = 0;
};
class tyu2 : public tyu{//実装
public:
	tyu2(){}
	~tyu2(){}
	void Run(){plus++;}
};
class tyu3{//そのまんまクラス
public:
	int plus;
	tyu3(){}
	~tyu3(){}
	void Run(){plus++;}
};

int main(){
	//抽象クラスを通して
	{
		tyu *p = new tyu2;
		boost::progress_timer t;
		for(int i=0;i<LOOPNUM;i++){
			p->Run();
		}
	}
	//普通に。
	{
		tyu3 *p = new tyu3;
		boost::progress_timer t;
		for(int i=0;i<LOOPNUM;i++){
			p->Run();
		}
	}	
	//なんかブーストが信用できないので^^;
	{
		DWORD begin=0;
		DWORD time=0;
		
		tyu *p = new tyu2;
		
		begin=timeGetTime();
		for(int i=0;i<LOOPNUM;i++){
			p->Run();
		}
		time=timeGetTime()-begin;
		printf("tyu =%d \n",time);
	}
	//普通呼び出し
	{
		DWORD begin=0;
		DWORD time=0;
		
		tyu3 *p = new tyu3;
		
		begin=timeGetTime();
		for(int i=0;i<LOOPNUM;i++){
			p->Run();
		}
		time=timeGetTime()-begin;
		printf("tyu3 =%d \n",time);
	}
	
	
	Sleep(3000);
	return 0;
}



■参照渡しとポインタ渡しの仲介
日時:22:34 2003/04/29
結果:以下のようにやるとOKらしい
ソース:以下のです。

//いろんなものをインクルード
#include <stdio.h>
#include <windows.h>

#include <map>
void Print(int *pointer){
	printf(" %d",*pointer);
}
void Set(int &sansyou){
	Print(&sansyou);
}

int main(){

	int temp=100;
	Set(temp);
	Sleep(4000);

	return 0;
}

■どっちのほうが速いかな〜〜沢山引数のあるインライン関数VS少しだけ引数のあるインライン関数
日時:22:23 2003/05/02
結果:すごく多くすると沢山あるほうが勝って
6億ループくらいだと少ないほうが勝つらしい。

#include <stdio.h>
#include <windows.h>
#pragma comment(lib,"winmm")


bool AddLog( char *filename,char *str )
{
	static FILE *fp=NULL;
	fp=NULL;
	char *s=str;
	if(NULL != (fp = fopen( filename , "at" ))){
		fputs( s , fp ) ;
		printf(s);
		fclose( fp ) ;
	}else{
			return false;
	}
	return true;
}

void print(char *str,...){
	char s[1024];
	memset(s,0,sizeof(s));
	va_list VaList;
	va_start( VaList , str ) ;
	_vsnprintf( s ,1024, str , VaList ) ;
	va_end( VaList ) ;
	AddLog("Log.txt",s);
}

inline void Function(int x1, int y1, int x2, int y2,
										 int x3, int y3, int x4, int y4){
	int x=x1;
	int y=y1;
}

inline void Function2(int x1,int y1){
	int x=x1;
	int y=y1;
}
#include "LIMITS.H"
int
main( )
{
	LONGLONG loopnum=854775807 ;
	{
		DWORD time=timeGetTime();
		for(LONGLONG i=0;i<loopnum;i++){
			Function(1,2,3,4,5,6,7,8);
		}
		DWORD temp;
		print("function many arguments time is %d\n",temp=timeGetTime() - time);
		double one=(double)temp/loopnum;
		print("one process is %f\n",one);
	}

	{
		DWORD time=timeGetTime();
		for(LONGLONG i=0;i<loopnum;i++){
			Function2(1,2);
		}
		DWORD temp;
		print("function2 few arguments time is %d\n",temp=timeGetTime() - time);
		double one=(double)temp/loopnum;
		print("one process is %f\n",one);
	}
		
	Sleep(5000);

	return 0;
}


■インライン関数と仮想関数どっちが速いか?
日時:22:28 2003/05/02
結果:やっぱりインラインのほうが速い。

#include <stdio.h>
#include <windows.h>
#pragma comment(lib,"winmm")
#include "LIMITS.H"

bool AddLog( char *filename,char *str )
{
	static FILE *fp=NULL;
	fp=NULL;
	char *s=str;
	if(NULL != (fp = fopen( filename , "at" ))){
		fputs( s , fp ) ;
		printf(s);
		fclose( fp ) ;
	}else{
			return false;
	}
	return true;
}

void print(char *str,...){
	char s[1024];
	memset(s,0,sizeof(s));
	va_list VaList;
	va_start( VaList , str ) ;
	_vsnprintf( s ,1024, str , VaList ) ;
	va_end( VaList ) ;
	AddLog("Log.txt",s);
}

class I{
public:
	I(){}
	virtual ~I(){}
	virtual void Run() = 0;
};

class My : public I{
public:
	My(){}
	virtual ~My(){}
	virtual void Run(){}
	inline void In(){}
};

int
main( )
{
	My m;
	LONGLONG loopnum=854775807 ;
	{
		
		DWORD time=timeGetTime();
		for(LONGLONG i=0;i<loopnum;i++){
			m.Run();
		}
		DWORD temp;
		print("m.Run() time is %d\n",temp=timeGetTime() - time);
		double one=(double)temp/loopnum;
		print("one process is %f\n",one);
	}

	{
		DWORD time=timeGetTime();
		for(LONGLONG i=0;i<loopnum;i++){
			m.In();
		}
		DWORD temp;
		print("m,In() time is %d\n",temp=timeGetTime() - time);
		double one=(double)temp/loopnum;
		print("one process is %f\n",one);
	}
		
	Sleep(5000);

	return 0;
}


■派生したクラスはvirtual 以外のメンバを持っても大丈夫なのか?
日時:22:21 2003/05/03
結果:OKのようです。
ソース:

#include <stdio.h>
#include <windows.h>


class I{
public:
	I(){}
	virtual ~I(){}
	virtual void Run() = 0;
};

class My : public I{
public:
	My(){}
	virtual ~My(){}
	virtual void Run(){Normal();}
	void Normal(){printf("OK");}

};

int
main( )
{
	I *i=new My;
	i->Run();
		
	Sleep(5000);

	return 0;
}

■バイトオフセットって何や!?
日時:21:17 2003/05/17
結果:3を吐く
サンプル
#include <windows.h>
#include <stdio.h>
int main(){
	char str[100];
	sprintf(str,"ARE YOU OK");
	char *temp=str;
	char *temp2=temp;
	temp+=3;
	int offset = (int)(temp-temp2);
	printf("offset= %d",offset);
	Sleep(5000);
}


■operator newをグローバルネームスペースで宣言したらどうなるん!?
日時:12:29 2003/05/24
結果:以下のようになる。
operator new(unsigned int 152) line 26
_STL::__stl_new(unsigned int 152) line 98 + 33 bytes
_STL::__node_alloc<1,0>::allocate(unsigned int 152) line 251 + 42 bytes
_STL::allocator<int *>::allocate(unsigned int 38, const void * 0x00000000) line 355 + 18 bytes
_STL::_STLP_alloc_proxy<int * *,int *,_STL::allocator<int> >::allocate(unsigned int 38) line 504
_STL::deque<int,_STL::allocator<int> >::_M_reallocate_map(unsigned int 28, unsigned char 0) line 650 + 15 bytes
_STL::deque<int,_STL::allocator<int> >::_M_reserve_map_at_back(unsigned int 28) line 912
_STL::deque<int,_STL::allocator<int> >::_M_new_elements_at_back(unsigned int 873) line 614
_STL::deque<int,_STL::allocator<int> >::_M_reserve_elements_at_back(unsigned int 900) line 897
_STL::deque<int,_STL::allocator<int> >::_M_fill_insert(_STL::_Deque_iterator<int,_STL::_Nonconst_traits<int> > {...}, unsigned int 900, const int & 0) line 138
_STL::deque<int,_STL::allocator<int> >::insert(_STL::_Deque_iterator<int,_STL::_Nonconst_traits<int> > {...}, unsigned int 900, const int & 0) line 655
_STL::deque<int,_STL::allocator<int> >::resize(unsigned int 1000, const int & 0) line 696
_STL::deque<int,_STL::allocator<int> >::resize(unsigned int 1000) line 698 + 52 bytes
main() line 22
mainCRTStartup() line 206 + 25 bytes
KERNEL32! 77e7847c()

ソース:
#include <stdio.h>
#include <windows.h>
#include <math.h>

#pragma comment(lib, "winmm.lib")

#include <deque>
int main(){
	std::deque<int> q(100);
	q.resize(1000);
}

static void *operator new(size_t size)
{
	return malloc(size);
}
static void *operator new[](size_t size)
{	
	return malloc(size);
}
static void operator delete[](void* obj)
{
	free(obj);
}
static void operator delete(void* obj)
{
	free(obj);	
}

SEO [PR] 爆速!無料ブログ 無料ホームページ開設 無料ライブ放送