Skip to content

Instantly share code, notes, and snippets.

View kazmura11's full-sized avatar

Kaz Mu kazmura11

View GitHub Profile
@kazmura11
kazmura11 / sample.cpp
Last active August 29, 2015 14:22
How to use std::list
#include <iostream>
#include <list>
#include <algorithm>
#include <iterator>
int main()
{
std::list<int> ls { 12, 2, 3, 1, 5, 4, 13, 7, 8, 9, 10, 11, 6};
// とりあえず出力
std::copy(ls.begin(), ls.end(), std::ostream_iterator<int>(std::cout, " "));
scriptencoding utf-8
" vim:set ts=8 sts=2 sw=2 tw=0: (この行に関しては:help modelineを参照)
"
" An example for a Japanese version gvimrc file.
" 日本語版のデフォルトGUI設定ファイル(gvimrc) - Vim7用試作
"
" Last Change: 07-May-2013.
" Maintainer: MURAOKA Taro <koron.kaoriya@gmail.com>
"
" 解説:
@kazmura11
kazmura11 / main.c
Last active August 29, 2015 14:14
C言語のヘッダの書き方(main.c)
#define GLOBAL_VARIABLE_DEFINED /* 実体はこっち */
#include "global.h"
#include "a.h"
#include <stdio.h>
int main()
{
bar_proc();
g_FooBar.a = 1;
@kazmura11
kazmura11 / a.c
Created February 6, 2015 19:54
C言語のヘッダの書き方(a.c)
#include "a.h"
#include <stdio.h>
#include "Global.h"
// 構造体の完全な定義を書く
typedef struct tag_bar
{
int a;
int b;
char c[4];
@kazmura11
kazmura11 / a.h
Created February 6, 2015 19:53
C言語のヘッダの書き方(a.h)
#ifndef A_H_INCLUDED__
#define A_H_INCLUDED__
// 公開関数
void bar_proc();
// 下記は非公開 ちなみに.cにかいてstaticにする
//void bar_proc_1(Bar *bar);
//void bar_proc_2(Bar *bar, int n);
@kazmura11
kazmura11 / global.h
Created February 6, 2015 19:50
C言語のヘッダの書き方(global.h)
#ifndef GLOBAL_H_INCLUDED__
#define GLOBAL_H_INCLUDED__
// グローバル変数の名前の衝突を避けるための工夫
#ifdef GLOBAL_VARIABLE_DEFINED
# define GLOBAL /* INSTANCE */
#else
# define GLOBAL extern /* EXTERN */
#endif /* GLOBAL_VARIABLE_DEFINED */
@kazmura11
kazmura11 / MapTest.java
Last active August 29, 2015 14:13
Mapの使いどき
package prin.com;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
// なんでこんな構造になっているのかっていうツッコミはあると思いますが
// 説明のため あくまで簡易的な例です。
// idはA00000の形式で作られていて最初のアルファベットで部署が紐づいている
@kazmura11
kazmura11 / puyo.cpp
Last active August 29, 2015 14:13
ぷよぷよの問題(人材募集企画 2011年版 問題2)
// 3.5h
#include <iostream>
#include <memory.h>
namespace Puyo
{
struct Check2D
{
int x;
int y;
@kazmura11
kazmura11 / rvotest.cpp
Last active August 29, 2015 14:08
RVO/NRVOのテスト
#include <iostream>
// フツーこんなのなしだけどstringを継承したデバッグ用のクラス
class mystring : public std::string {
public:
// コンストラクタ
mystring() : std::string()
{
std::cout << "mystring constructor"
<< " mystring() called!" << std::endl;
@kazmura11
kazmura11 / MFCGoogleMapAppDlg.cpp
Last active August 29, 2015 14:08
MFCGoogleMapAppDlg.cppのソース
// MFCGoogleMapAppDlg.cpp : 実装ファイル
//
#include "stdafx.h"
#include "MFCGoogleMapApp.h"
#include "MFCGoogleMapAppDlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG