Skip to content

Instantly share code, notes, and snippets.

#include <vector>
class myclass{
public:
myclass(const std::vector<int>&){
throw std::exception();
}
private:
myclass() = delete;
};
#include <array>
#include <type_traits>
template <typename T, std::size_t N>
constexpr std::size_t size(const std::array<T, N> &a) { return a.size(); }
template <typename A> // テンプレートでなくても同じ
void f(const A &a) {
char x[a.size()]; // VLA扱いされる。std::array::size()はconstexprになっている
char y[size(a)]; // 一段噛ませると通る
#ifdef __GNUG__
#include <cxxabi.h>
std::string demangle(const std::string &s) {
int r;
char *const p = abi::__cxa_demangle(s.c_str(), 0, 0, &r);
if (r) return s;
try {
const std::string x(p);
free(p);
p = 0;
#include <iostream>
#include <thread>
#include <future>
#include <chrono>
#include <functional>
#include <deque>
struct task_queue {
task_queue() = default;
task_queue(const task_queue &) = delete;
@kikairoya
kikairoya / gthr-win32-gcc471.patch
Created January 22, 2012 10:10
implement condition-variable to gthr-win32 needed for std::thread family. modify from gcc-4.7.0.
diff --git a/libgcc/config/i386/gthr-win32.c b/libgcc/config/i386/gthr-win32.c
index ab1b69f..4b35582 100644
--- a/libgcc/config/i386/gthr-win32.c
+++ b/libgcc/config/i386/gthr-win32.c
@@ -1,11 +1,13 @@
/* Implementation of W32-specific threads compatibility routines for
libgcc2. */
-/* Copyright (C) 1999, 2000, 2002, 2004, 2008, 2009, 2011
+/* Copyright (C) 1999, 2000, 2002, 2004, 2008, 2009, 2011, 2012
@kikairoya
kikairoya / seh.cc
Last active December 10, 2022 15:19
SEH for gcc
/*
Copyright (c) 2012- kikairoya
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
diff --git a/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S b/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
index ee27876..25c3339 100644
--- a/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
+++ b/libs/context/src/asm/fcontext_i386_sysv_elf_gas.S
@@ -86,9 +86,13 @@ boost_fcontext_make:
movl %ecx, 0x14(%eax) /* save the address of the function supposed to run */
movl 0x20(%eax), %edx /* load the stack base */
+ pushl %ebx
pushl %eax /* save pointer to fcontext_t */
PROMPT_COMMAND='
echo
echo -en "[\e[33m$(whoami)\e[0m@\e[35m$(hostname)\e[0m \e[31m$(date +%T)\e[0m] \e[32m$(pwd | sed s:$HOME:~:)\e[0m "
if git branch 2> /dev/null > /dev/null ; then
if git branch | grep -q "(no branch)" ; then
echo "(no branch)"
else
echo -ne [$(git branch | grep \* | sed "s/.*\* \\(\(.\+\)\\)/\1/")]
fi
echo -ne " "
// ==UserScript==
// @include *****!!!!!! ここに gerrit の URI を入れる !!!!!!*****
// ==/UserScript==
// HookLib from http://ajalabox.blogspot.jp/2010/05/javascripthooklibjs.html
HookLib = {};
HookLib.chain = [];
HookLib.hook = function (funcname, hookfunc, options) {
var n = HookLib.chain.length;
*.swp
*~
*.o
*.a
vendor_test
gtest