2010-07-01から1ヶ月間の記事一覧

よく使うテンプレ

#include "Dxlib.h" int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { ChangeWindowMode( TRUE ) ; // ウインドウがアクティブではない状態でも処理を続行するか、フラグをセットする SetAlwaysRunFla…

List関連

object Main { def main(args: Array[String]){ // リストに格納 var countList = List("one", "two", "three", "four") // リストの最後尾に要素(+終端)追加 countList = countList:::"five"::Nil // リストの戦闘に要素を追加 countList = "zero"::countLi…

ウィンドウスタイルについての隠し関数

SetWindowStyleMode(int); である。 値 タイトルバー 枠 閉じる 最大化 最小化 備考 0 普通 ○ ○ △ ○ デフォルト 1 なし ○ × × × 2 なし × × × × 3 小さい ○ ○ × × 4 なし × × × × 2と同じ? 5 普通 ○ ○ × × 6 普通 ○ ○ △ ○ 0と同じ? 7 普通 ○ ○ ○ ○ 8 角が…

Scalaプログラミングを触り始めてしまった

Scalaがアツい! って事で触り始めてしもーた。 object HelloWorld { def main(args: Array[String]) { // var:型推論を行い、var = String型として生成される var a = "string buffer"; // 再代入可能 a = "str"; // 違う型の代入は不可能 // a = 1; printl…

std::bindをやっと理解

bindが今までイマイチ理解できてなかったけど、書いてみたら一発で理解。 要は、function(関数ポインタ/関数オブジェクト/ラムダ式)の引数を束縛して新しいfunctionオブジェクトを生成してるのね。 #include <functional> #include <iostream> using namespace std; void Func(int </iostream></functional>…

「C++0x」 std::lambda

C++

#include <functional> #include <iostream> using namespace std; int main(){ auto A = [](function<void ()> rhs)->int { cout << "lambda str!" << endl; // 引数で取った返り値なし:void,引数なし:()なfunctionを実行 rhs(); return 3; }; // void ()なラムダ式を、上のラムダ式に渡す </void></iostream></functional>…

std::bindを理解の続き

#include <functional> #include <iostream> using namespace std; struct Test{ void Func(int a, int b) { cout << a*b << endl; } }; int main(){ function<void (int)> func; Test t; func = bind(&Test::Func,&t,placeholders::_1,3); func(3); return 0; } func = bind(&Test::Func,&t,pl</void></iostream></functional>…

std::function

#include <functional> #include <iostream> using namespace std; // 関数オブジェクトを定義 class Func{ public: int operator()() { cout << "class str!" << endl; return 1; } }; // 関数を定義 int str() { cout << "func str!" << endl; return 2; } int main(){ function<int ()> </int></iostream></functional>…

GDで寄り底?

そろそろ日経平均は底打ち感は出てきた……ものの、正直まだ怖い。 今日の寄り時点で-10%なんで、いい加減上がってくれないとボク死んじゃう的な。 それはそうと、第一生命を監視銘柄に追加。 リバってきたら売りで入ろうかな。 あ、みずほFGは同値撤退しまし…

全面高にて

みずほFGの株を137円で現物買い。ここらが底だと思うんだがに。 他も回復基調なんで、9月10月には含み損から含み益に転換しそうだな。

std::unipue_ptrとstd::listその他の華麗な連携

VS2010すげえ! っていうか、C++0xが素敵っ! 下のようなのが書ける。 #include <list> #include <memory> #include <iostream> #include <utility> #include <algorithm> using namespace std; class Unit{ public: int pos_x,pos_y; Unit(int x, int y) : pos_x(x),pos_y(y){} virtual void Draw() = 0;</algorithm></utility></iostream></memory></list>…

アーカイブ内のフォントデータの読み込み

微妙に詰まったので記事る。 DXアーカイブ内に格納したTTFファイルを読んで、DXライブラリに登録するまでのコード。 // arc.dxa内にフォントファイル(font.ttf)があるとする int font_handle; void FontLoad() { int FONT_SIZE = 32; const char* filename =…

決算期に近づき、今日は楽観

日経2%上昇で寄り付き。ほぼ全面高で、今日は総楽観。 NYが上げた事からの上昇っぽい。・・つーか、買気配多すぎだろww