#ifndef HEADER_H
#define HEADER_H
//...
#endif //HEADER_H
is preferred to
template <typename T, void (*f)(T*)> | |
class delete_fun | |
{ | |
public: | |
void operator()(T* obj) const | |
{ | |
f(obj); | |
} | |
}; |
render.rs:5:2: 6:1 error: type `gldevice::GLDevice` does not implement any method in scope named `init` | |
render.rs:5 device.init() | |
render.rs:6 } |
let window; | |
do str::as_c_str("Project Guava") |cstr| { | |
window = SDL::SDL_CreateWindow(cstr, | |
SDL_WINDOWPOS_CENTERED, | |
SDL_WINDOWPOS_CENTERED, | |
512, 512, | |
(SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN)); | |
} | |
let context = SDL::SDL_GL_CreateContext(window); |
trait Persistable { | |
fn persist_test(&self) -> int; | |
} | |
fn persist<T: Persistable>(val : T) { | |
io::println(fmt!("Val: %d", val.persist_test())); | |
} | |
macro_rules! object( | |
($cname:ident { $($tname:ident : $typ:ty),* }) => ( |
<html> | |
<body> | |
<canvas id="cvs" width="1024" height="32"> | |
</canvas> | |
<script type="text/javascript"> | |
var size = 32; | |
var cvs = document.getElementById("cvs"); | |
cvs.width = size * size; | |
cvs.height = size; | |
var ctx = cvs.getContext('2d'); |
f = (v) -> | |
v | |
x = [a, f | |
b, 2] | |
y = {a: f | |
b: 2} |
funcall( | |
-> | |
doShit() | |
if x | |
moreShit() | |
) |
(defun substitute-pattern (pattern symbol) | |
"Add a font lock hook to replace the matched part of PATTERN with the | |
Unicode symbol SYMBOL looked up with UNICODE-SYMBOL." | |
(interactive) | |
(font-lock-add-keywords | |
nil `((,pattern (0 (progn (put-text-property (match-beginning 1) (match-end 1) | |
'display ,symbol) | |
nil)))))) | |
(defun substitute-patterns (patterns) |
SET (this_target PROJECT1) | |
PROJECT(${this_target}) | |
... | |
ADD_EXECUTABLE(#{this_target} ...) | |
SET (this_target PROJECT2) | |
PROJECT(${this_target}) |