Skip to content

Instantly share code, notes, and snippets.

View cjxgm's full-sized avatar
🦧
Recovering...

Giumo Clanjor (哆啦比猫/兰威举) cjxgm

🦧
Recovering...
View GitHub Profile
//
#include <stdexcept>
#include <vector>
#include <queue>
#include <utility>
#include <iostream>
#include <memory>
using namespace std;
struct Bitmap
@cjxgm
cjxgm / 1102.c
Created July 9, 2014 14:37
an elegant solution to poj 1102
#include <stdio.h>
static void hstretch(const char tbl[3], int n)
{
putchar(tbl[0]);
while (n--) putchar(tbl[1]);
putchar(tbl[2]);
putchar(' ');
}
@cjxgm
cjxgm / signal.hh
Last active August 29, 2015 14:03
a simple and clean implementation of a signal system in C++11
#pragma once
#include <functional>
#include <list>
// tue == std + 1
namespace tue
{
template <class ...Args>
struct Signal
{
@cjxgm
cjxgm / btn-anime.cc
Last active August 29, 2015 14:04
a simple animation renderer written in c++
#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <sstream>
#include <functional>
#include <cmath>
using namespace std;
namespace pro
@cjxgm
cjxgm / cl.cc
Created July 29, 2014 10:53
compile-time list in c++11
#include <iostream>
#include <utility>
using namespace std;
namespace list
{
using std::pair;
using std::make_pair;
struct nil {};
#include <iostream>
#include <sstream>
#include <string>
#include <regex>
using namespace std;
// regular expression
struct match_wrapper
{
@cjxgm
cjxgm / range.cc
Created August 24, 2014 10:43
test: iterator_range & custom iterator
#include <iostream>
#include <list>
using namespace std;
template <class Iterator>
struct iterator_range
{
using iterator = Iterator;
iterator_range(iterator _begin, iterator _end)
@cjxgm
cjxgm / channel.cc
Last active August 29, 2015 14:05
an inter-thread multiple-writer single-reader reliable communication channel
#include <iostream>
#include <string>
#include <functional>
#include <vector>
#include <type_traits>
#include <utility>
#include <mutex>
#include <condition_variable>
#include <thread>
#include <list>
@cjxgm
cjxgm / README.md
Last active August 29, 2015 14:05
a debug tool for c++11/14 to inspecting the copy/move/construct/destruct behavior of a class.

inspector

a debug tool for c++11/14 to inspecting the copy/move/construct/destruct behavior of a class.

usage example

see [this][1]

preview

![img][2]

@cjxgm
cjxgm / update.cc
Created August 27, 2014 13:28
partial update area merger
#include <iostream>
#include <list>
#include <algorithm>
#include <iterator>
using std::cout;
using std::endl;
// make sure a <= b, or swap a and b to make it sure.
template <class T>
void reorder(T& a, T& b)