第329章 std::tuple

std::tuple はテンプレート引数が多いと打ち込みにウンザリというのは良くあると思います。

tuple についてはガイドを使わなくとも、そのまま推論可能です。

  1 #include <tuple>
  2
  3 int main()
  4 {
  5 #if __cplusplus >= 201703L
  6   std::tuple y{1,2,3};
  7 #else
  8   std::tuple<int,int,int> y{1,2,3};
  9 #endif
 10 }

まあ、一行でこれだけ雄弁な物語が展開されるのも珍しいんじゃないですかね。

  6   std::tuple y{1,2,3};

以前は以下のようにキーボードを叩いてたわけですしね。

  8   std::tuple<int,int,int> y{1,2,3};

これは便利です。

Copyright 2017-2018, by Masaki Komatsu