Skip to content

Instantly share code, notes, and snippets.

@yumetodo
yumetodo / netdata.conf
Created April 1, 2018 10:25
For Apache 2.4.
<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
/*=============================================================================
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 March 30, 2018 23:20
literal operator templateを文字列リテラルに適用できると勘違いして作った産物
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;
}

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:

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"
私は長い間nullptrの型はvoid*と思い込んで居たのですが、実は違います。
nullptrの型はstd::nullptr_tとおなじになります。
std::nullptr_tは、cstddefヘッダでtypedefされている型で、decltype(nullptr)の別名となっています。内部的な型名は決まっていません。
decltypeは(後日解説予定ですが)C++11で追加された重要機能で引数の「型」を返します。つまり、decltype(nullptr)はnullptrの「型」です。そのまんまですね。(笑)
@yumetodo
yumetodo / .gitignore
Last active October 27, 2022 10:19
random_device warkaround for mingw gcc
*.exe
*.out
.vscode/
$NOCONFIGURE=1 ./autogen.sh
configure.ac:1528: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:1528: You should run autoupdate.
../../lib/autoconf/general.m4:2527: AC_TRY_LINK is expanded from...
configure.ac:1528: the top level
../../lib/m4sugar/m4sh.m4:505: AS_IF is expanded from...
../../lib/autoconf/general.m4:2518: AC_LINK_IFELSE is expanded from...
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.