Skip to content

Instantly share code, notes, and snippets.

View kazmura11's full-sized avatar

Kaz Mu kazmura11

View GitHub Profile
@kazmura11
kazmura11 / Builder.cpp
Last active July 29, 2020 17:22
Design Pattern Builder
#include <string>
#include <iostream>
#include <vector>
#include <memory>
// ピザ
class Pizza {
public:
void setDough(const std::string& dough) {
dough_ = dough;
@kazmura11
kazmura11 / iotest.cpp
Last active June 28, 2020 08:30
iotest.cpp streambuf_iterator simple implementation
#include <fstream>
#include <iostream>
#include <string>
#define USE_MY_LIB_
#ifdef USE_MY_LIB_
// 偽物ライブラリ
namespace MyLib
{
template
@kazmura11
kazmura11 / opeover.cpp
Last active February 25, 2020 14:12
オペレーターオーバーロードのサンプル
#include <iostream>
#include <memory>
#include <string>
#include <iomanip>
class Foo {
private:
int a_;
int b_;
int c_;
@kazmura11
kazmura11 / dllist.cpp
Last active January 21, 2020 16:04
DoublyLinkedList implementation (C++)
#include <iostream>
#include <string>
#include <stdexcept>
using namespace std;
template <typename T>
struct Node
{
T value_;
"---------------------------------------------------------------------------
" 検索の挙動に関する設定:
"
" 検索時に大文字小文字を無視 (noignorecase:無視しない)
set ignorecase
" 大文字小文字の両方が含まれている場合は大文字小文字を区別
set smartcase
" インクリメンタルサーチ
set incsearch
" 検索ハイライト
@kazmura11
kazmura11 / Bmi.h
Last active December 26, 2019 14:40
dll sample Bmi.h
#pragma once
#ifdef BMIDLL
#define BMIDLL_API __declspec(dllexport)
#else
#define BMIDLL_API __declspec(dllimport)
#endif
#include <string>
namespace MyUtil
@kazmura11
kazmura11 / sample3.cpp
Created December 31, 2016 20:46
mapからvectorへ
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <iostream>
auto main()->int
{
std::ios::sync_with_stdio(false);
// vector -> map
@kazmura11
kazmura11 / sample2.cpp
Created December 31, 2016 20:46
vectorからmapへ
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <iostream>
auto main()->int
{
std::ios::sync_with_stdio(false);
// vector -> map
@kazmura11
kazmura11 / sample1.cpp
Created December 31, 2016 20:45
mapの最小値を求める
#include <vector>
#include <unordered_map>
#include <algorithm>
#include <iostream>
auto main()->int
{
std::ios::sync_with_stdio(false);
std::unordered_map<std::string, int> m {{"a",1},{"b",2},{"c",3},{"d",4}};
@kazmura11
kazmura11 / csvutil.c
Last active March 28, 2016 07:40
ダブルクォートで囲まれたCSVの読込みテストプログラム
/**
* reference
* http://f4.aaacafe.ne.jp/~pointc/log1227.html
* ・一行の中のデータは ,(カンマ)で区切る。行の終りは改行。
* ・データがカンマやダブルクォートを含む場合は "(ダブルクォート)で囲む。
* ・データの中のダブルクォートはそれをダブルクォート2個("")で置き換える。
*/
#include <stdio.h>
char *setvalue(char *p, char *field, int size)