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/asio/coroutine.hpp> | |
#include <boost/asio/local/connect_pair.hpp> | |
#include <boost/asio/local/stream_protocol.hpp> | |
#include <iostream> | |
#include <sys/wait.h> | |
std::size_t | |
send_fd(boost::asio::local::stream_protocol::socket& socket, | |
int fd, | |
boost::system::error_code& ec) |
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
struct test_op | |
{ | |
using executor_type = boost::asio::io_context::executor_type; | |
executor_type get_executor() const noexcept | |
{ | |
return ctx1.get_executor(); | |
} | |
void 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
#include <lua.h> | |
#include <type_traits> | |
template<typename LuaPushable> | |
void LuaPush(lua_State& state, LuaPushable&& luaPushable); | |
template <> | |
void LuaPush(lua_State& state, const std::string& str) | |
{ | |
lua_pushlstring(&state, str.c_str(), str.length()); |
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 <typename T, typename U=void, typename... Types> | |
constexpr size_t index() { | |
return std::is_same<T, U>::value ? 0 : 1 + index<T, Types...>(); | |
} | |
template<size_t index, typename... T> | |
struct TypeAtIndex | |
{ | |
using type = typename std::tuple_element<index, std::tuple<T...>>::type; | |
}; |