Skip to content

Instantly share code, notes, and snippets.

@wehu
wehu / dc.rs
Last active August 29, 2015 14:19
A partial implementation of delimited continuation
fn expand_shift0(b: &Fn(&Fn()), k: &Fn()) {
b(k);
}
//fn expand_shift1<B>(b: &Fn(&Fn() -> B) -> B, k: &Fn() -> B) -> B {
// b(k)
//}
//fn expand_shift2<A, B>(b: &Fn(&Fn(A) -> B) -> B, k: &Fn(A) -> B) -> B {
@wehu
wehu / has_function_member.hpp
Last active August 29, 2015 14:10
A solution for testing if a class has a method in c++
/*
* Copyright 2014 huwei04@hotmail.com. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software