ホーム » VC » コンストラクタで static

2016年5月
1234567
891011121314
15161718192021
22232425262728
293031  

カテゴリー

アーカイブ

ブログ統計情報

  • 77,348 アクセス



コンストラクタで static

次の様なクラスで,VC 14 ではコンストラクタ内の static を呼出した段階で止まってしまう?
VC 12 まででは OK .


  class T_static {
  public:
    T_static () ;
    } ;
  T_static::T_static ()
  {
    {
      static T_static root ;
      }
    std::tout << _T("T_static") << std::endl ;
    }


コンストラクタの初期化動作を次の様に変更.
  T_static::T_static ()
  {
    static bool Initialized = false ;
    if (!Initialized) {
      Initialized = true ;
      static T_static root ;
      }
    std::tout << _T("T_static") << std::endl ;
    }

Is this 投稿 useful? Useful Useless 0 of 0 people say this 投稿 is useful.

コメントする

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

%d人のブロガーが「いいね」をつけました。