Skip to content

Instantly share code, notes, and snippets.

@windoze
windoze / gist:2717015
Created May 17, 2012 06:34
brew -v install boost
Homebrew 0.9
==> Downloading http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.bz2
Already downloaded: /Library/Caches/Homebrew/boost-1.49.0.tar.bz2
/usr/bin/tar xf /Library/Caches/Homebrew/boost-1.49.0.tar.bz2
==> ./bootstrap.sh --prefix=/usr/local/Cellar/boost/1.49.0 --libdir=/usr/local/Cellar/boost/1.49.0/lib
./bootstrap.sh --prefix=/usr/local/Cellar/boost/1.49.0 --libdir=/usr/local/Cellar/boost/1.49.0/lib
-n Building Boost.Build engine with toolset darwin...
Failed to build Boost.Build build engine
Consult 'bootstrap.log' for more details
@windoze
windoze / gist:2717019
Created May 17, 2012 06:36
brew --config
HOMEBREW_VERSION: 0.9
HEAD: 21635a39c02e549805183f9517330b3085702b0f
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: quad-core 64-bit sandybridge
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.2
GCC-4.0: N/A
GCC-4.2: build 5666
@windoze
windoze / gist:2717023
Created May 17, 2012 06:36
brew doctor
Your system is raring to brew.
@windoze
windoze / bootstrap.log
Created May 21, 2012 03:03
brew install -vd boost
###
### Using 'darwin' toolset.
###
rm -rf bootstrap
mkdir bootstrap
cc -o bootstrap/jam0 command.c compile.c debug.c expand.c glob.c hash.c hdrmacro.c headers.c jam.c jambase.c jamgram.c lists.c make.c make1.c newstr.c option.c output.c parse.c pathunix.c pathvms.c regexp.c rules.c scan.c search.c subst.c timestamp.c variable.c modules.c strings.c filesys.c builtins.c pwd.c class.c native.c md5.c w32_getreg.c modules/set.c modules/path.c modules/regex.c modules/property-set.c modules/sequence.c modules/order.c execunix.c fileunix.c
expand.c:85:28: warning: field precision should have type 'int', but argument has type 'long' [-Wformat]
printf( "expand '%.*s'\n", end - in, in );
~~^~ ~~~~~~~~
1 warning generated.
@windoze
windoze / make_function
Created December 9, 2014 15:20
make_function(Fn) and make_function_type<Fn>
// make_function
template<typename T> struct remove_class { };
template<typename C, typename R, typename... A>
struct remove_class<R(C::*)(A...)> { using type = R(A...); };
template<typename C, typename R, typename... A>
struct remove_class<R(C::*)(A...) const> { using type = R(A...); };
template<typename C, typename R, typename... A>
struct remove_class<R(C::*)(A...) volatile> { using type = R(A...); };
template<typename C, typename R, typename... A>
struct remove_class<R(C::*)(A...) const volatile> { using type = R(A...); };
@windoze
windoze / make_tuple_indices
Created December 9, 2014 15:22
make_tuple_indices extracts elements from tuple
template <std::size_t...> struct tuple_indices {};
template <std::size_t Sp, class IntTuple, std::size_t Ep> struct make_indices_imp;
template <std::size_t Sp, std::size_t... Indices, std::size_t Ep>
struct make_indices_imp<Sp, tuple_indices<Indices...>, Ep>
{ typedef typename make_indices_imp<Sp+1, tuple_indices<Indices..., Sp>, Ep>::type type; };
template <std::size_t Ep, std::size_t... Indices>
struct make_indices_imp<Ep, tuple_indices<Indices...>, Ep>
{ typedef tuple_indices<Indices...> type; };
@windoze
windoze / invoke
Created December 9, 2014 15:24
Call any callable with perfect forwarding
template <class Fp, class A0, class... Args>
inline auto invoke(Fp&& f, A0&& a0, Args&&... args)
-> decltype((std::forward<A0>(a0).*f)(std::forward<Args>(args)...))
{ return (std::forward<A0>(a0).*f)(std::forward<Args>(args)...); }
template <class Fp, class A0, class... Args>
inline auto invoke(Fp&& f, A0&& a0, Args&&... args)
-> decltype(((*std::forward<A0>(a0)).*f)(std::forward<Args>(args)...))
{ return ((*std::forward<A0>(a0)).*f)(std::forward<Args>(args)...); }
@windoze
windoze / apply
Created December 9, 2014 15:29
Call any callable with a string vector or array, use with make_function and make_tuple_indices gists
template<typename Vec, typename Ret, class... Args>
struct function_wrapper;
// function_wrapper
template<typename Vec, typename Ret, class... Args>
struct function_wrapper<Vec, std::function<Ret(Args...)>> {
typedef std::function<Ret(Args...)> function_type;
typedef std::tuple<typename std::decay<Args>::type...> arg_list_type;
typedef Ret result_type;
static constexpr size_t arity=sizeof...(Args);
#include <iostream>
#include <functional>
typedef std::function<int(int)> fii;
template<typename Fn>
auto f(Fn fn)
-> typename std::enable_if<!std::is_constructible<fii, Fn>::value, int>::type
{ return 10; }
@windoze
windoze / test.swift
Created September 15, 2015 07:45
Swift 2 compiler bug
struct A<T1, T2> {
var f:B<T1, T2>
var b:B<T2, T1>
var v:T1
}
struct B<T1, T2> {
}