This file contains 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 <boost/chrono.hpp> | |
#include <chrono> | |
// from https://github.com/boostorg/chrono/issues/41#issuecomment-538932927 | |
namespace sc = ::std::chrono; | |
namespace bc = ::boost::chrono; | |
namespace chrono_helper { | |
// std::is_same_v<to_std_ratio_t<boost::ratio<N,D>>, std::ratio<N,D>> | |
// if and only if N, D are coprime and D is positive |
This file contains 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 <int I, class... Ts> | |
decltype(auto) get(Ts&&... ts) { | |
return std::get<I>(std::forward_as_tuple(ts...)); | |
} |
This file contains 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 N, typename T, typename... types> | |
struct GetNthArgType { | |
using type = typename GetNthArgType<N - 1, types...>::type; | |
}; | |
template <typename T, typename... types> | |
struct GetNthArgType<0, T, types...> { | |
using type = T; | |
}; |
This file contains 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
// from https://www.cppstories.com/2020/09/variadic-pack-first.html/ | |
namespace detail | |
{ | |
template<typename Output, typename... Inputs> | |
void tempFunc(Output& output, Inputs const&... inputs) | |
{ | |
// implementation of f | |
} | |
template<typename... InputsThenOutput, size_t... InputIndexes> |
This file contains 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
namespace detail { | |
template <typename Res, typename... Args> | |
Obj<Res, Args...> NewObj(std::function<Res(Args...)>&& func) { | |
return std::make_shared<Obj<Res(Args...)>>(std::forward<std::function<Res(Args...)>&&>(func)); | |
} | |
} | |
namespace detail { | |
template <typename F> | |
struct function_traits : public function_traits<decltype(&std::decay<F>::type::operator())> {}; |
This file contains 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
# https://github.com/llvm/llvm-project/blob/main/compiler-rt/lib/asan/scripts/asan_symbolize.py | |
def dsym_producer(binary_path): | |
base='/path/to/dSYM/dir/' | |
filename = os.path.basename(binary_path) | |
if (binary_path.endswith('.dylib')): | |
sym = base + filename + '.dSYM' | |
else: | |
sym = base + filename + ".app.dSYM" | |
print(binary_path + ' -> ' + sym) | |
return [sym] |