Skip to content

Instantly share code, notes, and snippets.

#include "pimpl_impl.h"
#include "A.h"
template<>
struct pimpl<A>::implementation
{
void foo()
{
}
};
@sehe
sehe / test.cs
Created November 21, 2011 21:32
monodis for enumerables
using System.Collections.Generic;
public class Program
{
public static IEnumerable<int> UsingYield()
{
yield return 42;
}
public static IEnumerable<int> ReturningArray()
{
test
*.gch
*.o
tags
.depends
@sehe
sehe / Makefile
Created December 14, 2011 22:31
C++ Palindrome finder optimization
all: test
#CPPFLAGS+=-std=c++0x
CPPFLAGS+=-g -O3
CPPFLAGS+=-Wall
%:%.cpp
g++ $(CPPFLAGS) $^ -o $@
#include <boost/config/warning_disable.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
#include <iostream>
#include <string>
namespace client
{
namespace qi = boost::spirit::qi;
@sehe
sehe / Makefile
Created March 21, 2012 20:22 — forked from klmr/mini.cpp
Ambiguous function call grammar
all:mini alternative
CPPFLAGS+=-std=c++0x
CPPFLAGS+=-g -O0
%.o:%.cpp
g++ $(CPPFLAGS) $^ -o $@ $(LDFLAGS)
@sehe
sehe / expressions.vim
Created May 16, 2012 00:02
Vim expression evaluation playground
func! PositionLessThanEqual(a, b)
" echo 'a: ' . string(a:a)
" echo 'b: ' . string(a:b)
if (a:a[0] == a:b[0])
return (a:a[1] <= a:b[1]) ? 1 : 0
else
return (a:a[0] <= a:b[0]) ? 1 : 0
endif
endf
@sehe
sehe / DefaultingDictionary.cs
Created May 25, 2012 19:01
DefaultingDictionary<>
using System;
using System.Collections;
using System.Collections.Generic;
namespace SODemo
{
public class DefaultingDictionary<TKey, TValue> : IDictionary<TKey, TValue>
{
public static implicit operator DefaultingDictionary<TKey,TValue>(Dictionary<TKey,TValue> wrappable)
{
@sehe
sehe / test_sha2_gcc.cpp
Created June 5, 2012 07:05
gcc version testbed
#include <algorithm>
#include <stdexcept>
#include <array>
#include <vector>
#include <iostream>
#define _byteswap_uint64 __builtin_bswap64
#define _rotr(x,k) (((x)>>(k)) | ((x)<<(32-(k))))
template<typename T> struct Output {