Boost 1.56.0 Beta 1が出ました。
日本語リリースノートは、あと2つくらい残ってますが、だいたい訳してあります。
大きな問題がなければ、2週間くらいでリリースされるでしょう。
Boost 1.56.0 Beta 1が出ました。
日本語リリースノートは、あと2つくらい残ってますが、だいたい訳してあります。
大きな問題がなければ、2週間くらいでリリースされるでしょう。
C++17の標準ライブラリに入れる予定の機能を、std::expreimental
名前空間で先行してリリースし、使用経験を得るためのTechnical Specificationの状況。
C++14は8月15日まで、各国の投票待ち。
以下のTechnical Specificationを、投票のために提出した。
not1
、not2
を汎用化したnot_fn
(N4076)と、optional
の修正(N4078)を承認した。
そのほか、
#include <iostream> #include <typeinfo> struct Base { virtual void member_function() {} // 仮想関数を持たせておく必要がある }; struct Derived : public Base {}; int main() { Base* p = new Derived(); if (typeid(*p) == typeid(Base)) { std::cout << "Base" << std::endl; } if (typeid(*p) == typeid(Derived)) { std::cout << "Derived" << std::endl; } }
出力:
Derived
破壊的変更なので、ブログに載せておきます。
以下のコミットで、tagged_int
とtagged_real
のコンストラクタを、explicit
に変更しました。
この変更により、これらのクラスを使っていたコードのコンパイルが通らなくなる可能性があります。
この変更をしたのは、以下のようなコードをコンパイルエラーにしたかったからです。
#include <iostream> #include <shand/strong_typedef/tagged_int.hpp> struct Tag {}; using integer = shand::tagged_int<int, Tag>; void f(integer x) {} int main() { f(3); // コンパイルエラーになってほしい // f(integer(3)); // こう渡してほしい }
つまり、関数の引数としてリテラルを渡す際に、それがどの用途の数値型なのかを明示してほしかったのです。
Chronoライブラリのduration
も、コンストラクタがexplicit
になっているので、それに合わせた形になります。
Boost 1.56.0のリリースまでもう少しかかりそうなので、Boostの近況を書きます。
Boostへのライブラリリクエストの方法を改善する。
Boostを進化させるための新たなガイドライン
C++11標準で提供されているduration
のエイリアスは整数のみですが、浮動小数点数もそれなりに使うので、エイリアスを用意しました。
「何秒間で処理を行う」というAPIの引数がdouble
になってる場合がけっこう多いです。
namespace shand { template <class Rep> using nanoseconds_t = std::chrono::duration<Rep, std::nano>; using nanoseconds_f = nanoseconds_t<float>; using nanoseconds_d = nanoseconds_t<double>; using nanoseconds_ld = nanoseconds_t<long double>; template <class Rep> using microseconds_t = std::chrono::duration<Rep, std::micro>; using microseconds_f = microseconds_t<float>; using microseconds_d = microseconds_t<double>; using microseconds_ld = microseconds_t<long double>; template <class Rep> using milliseconds_t = std::chrono::duration<Rep, std::milli>; using milliseconds_f = milliseconds_t<float>; using milliseconds_d = milliseconds_t<double>; using milliseconds_ld = milliseconds_t<long double>; template <class Rep> using seconds_t = std::chrono::duration<Rep>; using seconds_f = seconds_t<float>; using seconds_d = seconds_t<double>; using seconds_ld = seconds_t<long double>; template <class Rep> using minutes_t = std::chrono::duration<Rep, std::ratio<60>>; using minutes_f = minutes_t<float>; using minutes_d = minutes_t<double>; using minutes_ld = minutes_t<long double>; template <class Rep> using hours_t = std::chrono::duration<Rep, std::ratio<3600>>; using hours_f = hours_t<float>; using hours_d = hours_t<double>; using hours_ld = hours_t<long double>; } // namespace shand