Rokiのチラ裏

学生による学習のログ

2017-12-01から1ヶ月間の記事一覧

Polymorphic Memory Resources

C++

先日策定された C++17 から追加された Polymorphic Memory Rerouces についてのメモ。同提案でも言及されている通りstd::allocatorは、型にそのアロケータ情報を含む事で利用されるため、コンパイル時にしか指定することが出来ず、結果として同じ型のオブジ…

implicitly capture の振る舞い

C++

以下の例が成り立つ。 const int i = 123; // #1 const float f = 123.f; // #2 []{ i; }(); // OK []{ f; }(); // ill-formed C++17 のラムダ式における reaching scope に関する記述 n4659/[expr.prim] 3, 7, n4659/[expr.prim.lambda.capture] 8 から引用…

Java Evaluate Operands before Operation

Java の order of eval についてメモ。 x = 1; x = ++x + x++; // 3 が保証される JLS 15.7.2. Evaluate Operands before Operation から引用。 The Java programming language guarantees that every operand of an operator (except the conditional opera…