Skip to content

Instantly share code, notes, and snippets.

View benjamn's full-sized avatar

Ben Newman benjamn

View GitHub Profile
@benjamn
benjamn / gist:30895
Created December 1, 2008 23:30
undefined
template <typename M>
M* Create() {
ParserQueueMsg* msg = new M;
nsAutoLock synchronized(mLock);
Push(msg);
return static_cast<M*>(msg);
}
typedef struct Nil {};
template <typename H, typename T>
class Cons : public T {
protected:
typedef T BaseType;
H mVal;
};
class Foo : public Cons<int, Cons<char*, Cons<bool, Nil> > >
typedef struct Nil {};
template <typename H, typename T>
class Cons : public T {
protected:
typedef T BaseType;
H mVal;
public:
BaseType &operator()(H aVal) {
mVal = aVal;
template <typename CAR, typename CDR>
class cons : public std::pair<CAR, CDR>
{
public:
cons(CAR& car, CDR& cdr)
: std::pair<CAR, CDR>(car, cdr)
{}
};
diff --git a/js/src/xpconnect/src/xpcthrower.cpp b/js/src/xpconnect/src/xpcthrower.cpp
--- a/js/src/xpconnect/src/xpcthrower.cpp
+++ b/js/src/xpconnect/src/xpcthrower.cpp
@@ -257,16 +257,18 @@ XPCThrower::BuildAndThrowException(JSCon
// most likely out of memory
if(!success)
JS_ReportOutOfMemory(cx);
}
static PRBool
struct test_struct {
double f(int x, double y) {
return x + y;
}
};
double test() {
int x = 1;
double y = 1.5;
test_struct tc;
typedef void (A::*Setter)(int val);
void set(A* a, Setter s, int val) {
(a->*s)(val);
}
class A {
int mVal;
void setVal(int val) { mVal = val; }
public:
Index: plugins/Markdown/Markdown.pl
===================================================================
--- plugins/Markdown/Markdown.pl (revision 3290)
+++ plugins/Markdown/Markdown.pl (working copy)
@@ -184,6 +184,8 @@
# contorted like /[ \t]*\n+/ .
$text =~ s/^[ \t]+$//mg;
+ $text = _DoLaTeX($text);
+
Index: plugins/Markdown/Markdown.pl
===================================================================
--- plugins/Markdown/Markdown.pl (revision 3290)
+++ plugins/Markdown/Markdown.pl (working copy)
@@ -184,6 +184,8 @@
# contorted like /[ \t]*\n+/ .
$text =~ s/^[ \t]+$//mg;
+ $text = _DoLaTeX($text);
+
#include <iostream>
// Recursive case:
template <int N> struct Fib {
enum { val = Fib<N-1>::val
+ Fib<N-2>::val };
};
// Base cases:
template <> struct Fib<0> { enum { val = 0 }; };