Skip to content

Instantly share code, notes, and snippets.

View unique_factorization.hpp
#include <iostream>
#include <cstdint>
#include <vector>
#include <cmath>
struct unique_factorization_element {
std::uint32_t prime;
std::uint8_t pow;
};
std::ostream& operator<< (std::ostream& os, const unique_factorization_element& e)
{
@yumetodo
yumetodo / contiguous_iterator.hpp
Last active Dec 17, 2018
inferior vector util
View contiguous_iterator.hpp
#ifndef INFERIOR_ITERATOR_CONTIGUOUS_ITERATOR_HPP_
#define INFERIOR_ITERATOR_CONTIGUOUS_ITERATOR_HPP_
#include <inferior/no_min_max.h>
#include <cstddef>
#include <iterator>
#include <inferior/type_traits.hpp>
namespace inferior {
template<typename Container>
class contiguous_iterator {
View hatena_blog_katex_loader.js
document.addEventListener("DOMContentLoaded", () => {
"use strict";
Array.from(document.getElementsByClassName("math-render"))
.filter(e => !e.mathRendered)
.forEach(e => {
try {
katex.render(e.textContent, e, {displayMode: true });
} catch (ex) {
e.textContent = ex.message;
}
@yumetodo
yumetodo / pgm_p2_reformater.cpp
Created May 21, 2018
pgm(P2) image reformatter
View pgm_p2_reformater.cpp
#include <iostream>
#include <sstream>
#include <string>
int proc_main(std::istream& is, std::ostream& os)
{
std::string pn;
if(!std::getline(is, pn)) return 1;
if("P2" != pn) return 2;
std::string tmp;
if(!std::getline(is, tmp)) return 3;
View netdata.conf
<VirtualHost *:80>
ServerName netdata.irregular-at-tus.work
ServerAdmin https://qiitadon.com/@yumetodo
DocumentRoot /usr/share/netdata/web/
Redirect permanent "/" "https://netdata.irregular-at-tus.work/"
ErrorLog /home/for_netdata/logs/netdata-error.log
View inferior_encrypted_string.hpp
/*=============================================================================
Copyright (C) 2018 yumetodo <yume-wikijp@live.jp>
Distributed under the Boost Software License, Version 1.0.
(See https://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
//ref: http://dxlib.o.oo7.jp/cgi/patiobbs/patio.cgi?mode=view&no=4371
#include <string>
#if defined(__clang__)
# if !__has_feature(cxx_constexpr)
@yumetodo
yumetodo / codepoint_count_from_template_param_packed_chars.hpp
Created Mar 30, 2018
literal operator templateを文字列リテラルに適用できると勘違いして作った産物
View codepoint_count_from_template_param_packed_chars.hpp
inline constexpr int get_u8_byte_count(char ch) {
if (0 <= uint8_t(ch) && uint8_t(ch) < 0x80) {
return 1;
}
if (0xC2 <= uint8_t(ch) && uint8_t(ch) < 0xE0) {
return 2;
}
if (0xE0 <= uint8_t(ch) && uint8_t(ch) < 0xF0) {
return 3;
}
View keybase.md

Keybase proof

I hereby claim:

  • I am yumetodo on github.
  • I am yumetodo (https://keybase.io/yumetodo) on keybase.
  • I have a public key whose fingerprint is 734D 8C63 06B6 F43A 6FBF D64C 0999 48A2 4590 1ACB

To claim this, I am signing this object:

View libstdc++_vector_tcc__M_check_len.dot
digraph G {
"_M_realloc_insert" -> "_M_check_len"
"_M_fill_insert" -> "_M_check_len"
"_M_default_append" -> "_M_check_len"
"_M_range_insert" -> "_M_check_len"
"emplace_back" -> "_M_realloc_insert"
"insert" -> "_M_realloc_insert"
"_M_insert_rval" -> "_M_realloc_insert"
"_M_emplace_aux" -> "_M_realloc_insert"
"push_back" -> "_M_realloc_insert"
View a.txt
私は長い間nullptrの型はvoid*と思い込んで居たのですが、実は違います。
nullptrの型はstd::nullptr_tとおなじになります。
std::nullptr_tは、cstddefヘッダでtypedefされている型で、decltype(nullptr)の別名となっています。内部的な型名は決まっていません。
decltypeは(後日解説予定ですが)C++11で追加された重要機能で引数の「型」を返します。つまり、decltype(nullptr)はnullptrの「型」です。そのまんまですね。(笑)
You can’t perform that action at this time.