2017-10-16から1日間の記事一覧

静的なメンバ定数を参照するとリンクエラーとなる

C++

クラス内にstatic constexpr Tで宣言した定数を、std::vector::emplace_back()関数とかに渡すと、リンクエラーになる場合があります。 ミニマムなコードとしては、以下のようになります: struct X { static constexpr int x = 3; }; template <class T> void f(T&&) </class>…