Skip to content

Instantly share code, notes, and snippets.

// PLUGIN_INFO//{{{
var PLUGIN_INFO =
<VimperatorPlugin>
<name>{NAME}</name>
<description>character hint mode.</description>
<author mail="konbu.komuro@gmail.com" homepage="http://d.hatena.ne.jp/hogelog/">hogelog</author>
<version>0.3.2</version>
<minVersion>2.3pre 2010/01/26</minVersion>
<maxVersion>2.4pre</maxVersion>
<updateURL>http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk/char-hints-mod2.js</updateURL>
// せつめい
// C++ 0x で関数と引数を pack したタプルから関数適用を行う apply を実装した。
// apply を実装するには tuple の値を variadic arguments に変換する必要がある。
// 束縛済み引数の数で特殊化してやる。0 なら関数を呼ぶ。 1 以上の場合は値を一つずつ積んでいく。
// 返値型を求めようと auto impl(...) -> decltype(impl(...)) のようなコードを書くのは正しくない。
// impl の宣言に impl を利用することは当然できない。それが実際には異なるパラメータを持つ関数テンプレートであったとしても…
// declval を使って fun の返値を求めることで解決する。
#include <tuple>
#include <type_traits>
// apply を利用した実装メモ
// primary
template <typename Ret, typename Args>
struct RetType;
template <typename Ret>
struct RetType<Ret, tuple<>> {
typedef Ret type;
};
// せつめい
// C++ 0x で (T1, T2, ... TN) -> R を T1 -> (T2 -> ... TN)..) -> Ret する curry を実装した。
// tuple に引数を溜めていき、最後に apply を利用して関数を呼び出す。
// decltype は再帰関数のシグネチャには使えないので返値型を計算する type function を書いた。
// enable_if で頑張れば書けそうだけれど(apply 可能かどうか)面倒なのでジェネリックには実装していない。
#include <tuple>
#include <type_traits>
#include <functional>
--- ls-files.c 2010-07-02 00:29:48.206993409 +0900
+++ ls-files.c.orig 2010-07-02 00:29:41.022986503 +0900
@@ -13,6 +13,7 @@
#include "parse-options.h"
#include "resolve-undo.h"
#include "string-list.h"
+#include "color.h"
static int abbrev;
static int show_deleted;
let w:gx_history_list = [{}]
let w:gx_history_current_index = 0
let w:gx_original_qflist = {}
function! s:GetCurrentQFIndex()
let qflist = getqflist()
if empty(qflist)
return -1
endif
#include <cstdio>
template <typename... seq>
struct array;
template <typename ary>
struct head;
template <typename first, typename... rest>
struct head<array<first, rest...>> {
#include <cstdio>
#include <iostream>
#include <typeinfo>
#include <cxxabi.h>
char* demangle(const char *demangle) {
int status;
return abi::__cxa_demangle(demangle, 0, 0, &status);
}
template <bool cond, typename _, typename else_>
struct enable_if { typedef typename else_::type type; };
template <typename then_, typename _>
struct enable_if<true, then_, _>{ typedef typename then_::type type; };
template <int n>
struct num {
static const int value = n;
typedef num<n> type;
};
まず
AAA
BBB
みたいなのじゃ困る、という要求があって
process {
lock m
modify v