This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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...); }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)...); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct A<T1, T2> { | |
var f:B<T1, T2> | |
var b:B<T2, T1> | |
var v:T1 | |
} | |
struct B<T1, T2> { | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <array> | |
#include <vector> | |
#include <iostream> | |
#include <random> | |
inline constexpr uint32_t subnet_mask(int len) { | |
return 0xFFFFFFFF >> (32-len) << (32-len); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "rxcpp/rx-scheduler.hpp" | |
// TODO: C++17 Networking TS | |
#ifdef WITHOUT_BOOST | |
// Standalone ASIO | |
#include <asio.hpp> | |
namespace asio_ns=::asio | |
namespace system_ns=::std | |
#else | |
// Boost.ASIO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <random> | |
#include <unordered_map> | |
#include <vector> | |
class EventList { | |
public: | |
void insert(std::pair<size_t, size_t> event_with_ts) { | |
if(event_idx.find(event_with_ts.first)==event_idx.end()) { | |
events.push_back(event_with_ts); | |
event_idx[event_with_ts.first]=events.size()-1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", | |
"contentVersion": "1.0.0.0", | |
"parameters": { | |
"adminUsername": { | |
"type": "string", | |
"metadata": { | |
"description": "Admin username for VM" | |
} | |
}, |
OlderNewer