This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void f() {} // do nothing | |
template<typename T, typename... Tail> | |
void f(T head, Tail... tail) | |
{ | |
g(head); // headに対し何かする | |
f(tail...); // 再度tailに対し実行 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() | |
{ | |
cout << "first: "; | |
f(1, 2.2, "hello"); | |
cout << "\nsecond: "; | |
f(0.2, 'c', "yuck!", 0, 1, 2); | |
cout << "\n"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <stack> | |
using namespace std; | |
class Node { | |
public: | |
int val; | |
Node *left, *right; | |
Node(int v): val(v) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <fstream> | |
#include <regex> | |
using namespace std; | |
/* | |
Usage: $ g++ -std=c++11 regex_search_sample.cpp && ./a.out | |
// example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <vector> | |
/* | |
Usage: g++ -std=c++11 foo.cpp | |
*/ | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#define MAX_X 5 | |
#define MAX_Y 5 | |
using namespace std; | |
typedef struct { | |
int x[MAX_X]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <queue> | |
#include <climits> | |
#include "./graph_elements.h" | |
#define MAX_N 10000 | |
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
/* | |
usage: go run multi_dimension_array_play.go | |
*/ | |
var multiDimensionArray = [2][5]int{ {1, 2, 3, 4, 5}, {6, 7, 8, 9, 10} } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
const ( | |
StationNumber = 6 | |
StartStation = 0 | |
) | |
var ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double accum(double* beg, double* end, double init) | |
{ | |
return accumulate(beg, end, init); | |
} | |
double comp2(vector<double>& v) | |
{ | |
using Task_type = double(double*, double*, double); | |
packaged_task<Task_type> pt0 { accum }; // タスク(i.e., accum)をパッケージ化 | |
packaged_task<Task_type> pt1 { accum }; |