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 <Windows.h> | |
#include <vector> | |
#include <string> | |
BOOL utf8_to_sjis(BYTE* pSource, BYTE* pDist, int* pSize) | |
{ | |
*pSize = 0; | |
//UTF-8 -> UTF-16 | |
const int nSize = ::MultiByteToWideChar(CP_UTF8, 0, (LPCSTR) pSource, -1, NULL, 0); |
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 <algorithm> // std::min | |
#include <cstddef> // std::size_t, std::ptrdiff_t | |
#include <iterator> // std::reverse_iterator | |
#include <stdexcept> // std::out_of_range | |
#include <utility> // std::index_sequence, std::forward | |
namespace experimental { | |
namespace detail { | |
constexpr std::size_t strlen(char const* str, std::size_t n) { | |
return *str ? strlen(++str, n + 1) : n; |
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.hpp> | |
#include <boost/date_time/posix_time/posix_time.hpp> | |
#include <functional> | |
#include <iostream> | |
#include <thread> | |
class printer | |
{ | |
boost::asio::deadline_timer timer1; | |
boost::asio::deadline_timer timer2; |
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
@echo off | |
if "%~dpnx1" equ "" goto :eof | |
setlocal | |
set tempfile=%date:~4%%time::=% | |
set tempfile=%tempfile:/=% | |
set tempfile=%tempfile:.=% | |
set tempfile=%tempfile: =% | |
clang++ -o %tempfile%.exe "%~dpnx1" -std=c++1z |
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 <iostream> | |
class drawable | |
{ | |
struct vtable | |
{ | |
void(*draw)(void*); | |
}; | |
template <typename 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
/* | |
入力 | |
4 | |
0 0 1 0 | |
0 1 1 0 | |
0 1 0 1 | |
1 1 1 0 | |
3 | |
0 1 1 | |
0 1 0 |
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 <vector> | |
#include <numeric> | |
#include <unordered_map> | |
#include <iterator> | |
#include <functional> | |
#include <type_traits> | |
#include <utility> | |
template <typename T, typename A> | |
std::string to_string(std::vector<T, A> const& v); |
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
constexpr int f() { return 0; } | |
constexpr int g(); | |
static_assert(noexcept(f()), ""); | |
static_assert(!noexcept(g()), ""); | |
constexpr int h(bool b) { return b ? 0 : throw 42; } | |
static_assert(noexcept(h(true)), ""); | |
static_assert(!noexcept(h(false)), ""); |
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 <initializer_list> | |
#include <iostream> | |
#include <string> | |
#include <tuple> | |
#include <type_traits> | |
#include <unordered_map> | |
#include <utility> | |
#include <vector> | |
template <typename F, typename... Args> |
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 <iterator> | |
#include <type_traits> | |
template <class Container> | |
auto to_index(const Container& container, typename Container::const_iterator it) | |
-> decltype(std::distance(std::begin(container), it)) | |
{ | |
static_assert(std::is_same< | |
typename std::iterator_traits< | |
typename Container::const_iterator |