Skip to content

Instantly share code, notes, and snippets.

View ThePhD's full-sized avatar
🐑
Ready to roll!

The Phantom Derpstorm ThePhD

🐑
Ready to roll!
View GitHub Profile
#pragma once
#include <Furrovine++/integral_type.h>
#include <Furrovine++/direct.h>
namespace Furrovine {
namespace detail {
template <std::size_t n, std::size_t m>
struct t_pow {
template <typename T>
inlinealways T pi( ) {
const static long double p = 3.1415926535897932384626433832795028841971693;
return static_cast<T>( p );
}
template <typename T>
inlinealways T two_pi( ) {
return static_cast<T>( pi<long double>( ) * 2 );
}
@ThePhD
ThePhD / indices_trick.h++
Created July 1, 2014 10:17
indices_trick
#pragma once
#include <Furrovine++/unqualified.h>
#include <tuple>
namespace Furrovine {
template <std::size_t... I>
struct indices { typedef indices type; };
void ThreadPool::QueueWork( TWork item ) {
static const std::size_t n = 256;
typedef fixed_vector<proxy_cost_t, n> container_t;
std::lock_guard<std::mutex> lockguard( additionalworklock );
container_t workingcosts( threads.size( ) );
for ( std::size_t i = 0; i < workingcosts.size( ); ++i ) {
workingcosts[ i ].first = costs[ i ].id;
workingcosts[ i ].second = costs[ i ].cost;
}
T& value( ) const {
typedef decltype( std::addressof( storage ) ) storage_address_t;
typedef typename std::conditional<std::is_const<T>::value, const void, void>::type void_t;
typedef typename std::remove_const<storage_address_t>::type address_t;
return *static_cast<T*>( static_cast<void_t*>( const_cast<address_t>( std::addressof( storage ) ) ) );
}
bool present;
struct storage_t {
T& ref;
} storage;
template <typename... Tn>
void place( Tn&&... argn ) {
assert( !present );
unchecked_place( std::forward<Tn>( argn )... );
}
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\accctrl.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\aclapi.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\aclui.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\activation.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\activaut.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\activecf.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\activeds.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\mingw64\x86_64-w64-mingw32\include\activprof.h"
skip file "C:\Program Files\mingw-w64\x86_64-4.9.0-posix-seh-rt_v3-rev2\min
@ThePhD
ThePhD / Bleh.c++
Created May 21, 2014 22:27
Lame initializer_list and its rules
SeparableKernelFilter( std::initializer_list<float> kx, std::initializer_list<float> ky )
: SeparableKernelFilter( std::move( kx ), std::move( ky ), dummy ) {
}
template <typename Tx, typename Ty>
SeparableKernelFilter ( Tx&& xkern, Ty&& ykern, dummy_t = dummy ) {
for ( auto& x : xkern ) {
xkernel.push_back( static_cast<float>( x ) );
}
for ( auto& y : ykern ) {
@ThePhD
ThePhD / lua_class.c++
Last active August 29, 2015 14:00
lua_class.c++ final
#include <sol/state.hpp>
#include <sol/lua_function.hpp>
#include <sol/demangle.hpp>
#include <vector>
namespace sol {
template <typename... Tn>
struct constructors { };
@ThePhD
ThePhD / lua_class.c++
Last active August 29, 2015 14:00
lua_class.c++
namespace sol {
template <typename... Tn>
struct constructors { };
template <typename T>
class lua_class {
public:
static const std::string classname;
static const std::string meta;