title: Iterating through a vector of tuples c+17 style don't work?
body: <p>I am currently looking neat ways in which i can iterate this vector of tuples..</p>
  
  <p>This is what I am currently doing?</p>
  
  <pre><code>#include &lt;experimental/filesystems&gt;
  #include &lt;tuple&gt;
  #include &lt;iostream&gt;
  #include &lt;vector&gt;
  
  
  std::tuple&lt;std::experimental::filesystem::path, std::experimental::filesystem::file_status, std::size_t&gt;
  file_info(const std::experimental::filesystem::directory_entry &amp;entry)
  {
  
      const std::experimental::filesystem::file_status fs(std::experimental::filesystem::status(entry));
      return {entry.path(),
                  fs,
                  std::experimental::filesystem::is_regular_file(fs) ? std::experimental::filesystem::file_size(entry.path()) : 0u};
  
  }
  
  
  
  int main ()
  {
      std::experimental::filesystem::path _path(string_dir_to_test_files);  // string_dir_to_test_files is just a string 
      std::experimental::filesystem::directory_entry dir_path(_path);
      if (std::experimental::filesystem::exists(_path))
      {
          std::cout &lt;&lt; "exists() = " &lt;&lt; std::experimental::filesystem::exists(_path) &lt;&lt; std::endl;
          std::cout &lt;&lt; "Number of files in directory: " &lt;&lt; number_of_files(_path) &lt;&lt; std::endl;
          std::vector&lt;std::tuple&lt;std::experimental::filesystem::path,std::experimental::filesystem::file_status, std::size_t&gt;&gt; items;
          std::transform(std::experimental::filesystem::directory_iterator(_path),{},back_inserter(items),file_info);
          for( auto const&amp; index : items)
          {
              std::cout &lt;&lt; std::get&lt;0&gt;(index) &lt;&lt; std::endl; // This line could be written better?
          }
      }
      else
      {
          std::cout &lt;&lt; "No data to build database with!" &lt;&lt; std::endl;
          exit(1);
      }
  
      return 0;
  }
  </code></pre>
  
  <p>Even though it does the job, it does not seem to be "reader" friendly, is there other ways in which I can the iterate the elements of the vector, in a more reader friendly manner?</p>
  
  <p>One way I tried to make the for loop a bit more readable was by making like this:</p>
  
  <pre><code>for (auto const&amp; [path, status, size] : items) {
      std::cout &lt;&lt; path &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>But this somehow give me this error: </p>
  
  <pre><code>/home/noob/soundcloud/src/include/database/database.cpp: In constructor ‘database::database()’:
  /home/noob/soundcloud/src/include/database/database.cpp:31:25: error: expected unqualified-id before ‘[’ token
           for(auto const&amp; [path, status, size] : items)
                           ^
  /home/noob/soundcloud/src/include/database/database.cpp:31:25: error: expected ‘;’ before ‘[’ token
  /home/noob/soundcloud/src/include/database/database.cpp:31:26: error: ‘path’ was not declared in this scope
           for(auto const&amp; [path, status, size] : items)
                            ^~~~
  /home/noob/soundcloud/src/include/database/database.cpp:31:26: note: suggested alternatives:
  In file included from /usr/include/c++/6/experimental/filesystem:39:0,
                   from /home/noob/soundcloud/src/include/database/database.h:9,
                   from /home/noob/soundcloud/src/include/database/database.cpp:1:
  /usr/include/c++/6/experimental/bits/fs_path.h:79:9: note:   ‘std::experimental::filesystem::v1::path’
     class path
           ^~~~
  /usr/include/c++/6/experimental/bits/fs_path.h:79:9: note:   ‘std::experimental::filesystem::v1::path’
  /home/noob/soundcloud/src/include/database/database.cpp:31:32: error: ‘status’ was not declared in this scope
           for(auto const&amp; [path, status, size] : items)
                                  ^~~~~~
  /home/noob/soundcloud/src/include/database/database.cpp:31:32: note: suggested alternatives:
  In file included from /usr/include/c++/6/experimental/filesystem:41:0,
                   from /home/noob/soundcloud/src/include/database/database.h:9,
                   from /home/noob/soundcloud/src/include/database/database.cpp:1:
  /usr/include/c++/6/experimental/bits/fs_ops.h:274:15: note:   ‘std::experimental::filesystem::v1::status’
     file_status status(const path&amp; __p, error_code&amp; __ec) noexcept;
                 ^~~~~~
  /usr/include/c++/6/experimental/bits/fs_ops.h:274:15: note:   ‘std::experimental::filesystem::v1::status’
  /home/noob/soundcloud/src/include/database/database.cpp:31:40: error: capture by copy of incomplete type ‘&lt;unresolved overloaded function type&gt;’
           for(auto const&amp; [path, status, size] : items)
                                          ^~~~
  /home/noob/soundcloud/src/include/database/database.cpp: In lambda function:
  /home/noob/soundcloud/src/include/database/database.cpp:31:46: error: expected ‘{’ before ‘:’ token
           for(auto const&amp; [path, status, size] : items)
                                                ^
  /home/noob/soundcloud/src/include/database/database.cpp: In constructor ‘database::database()’:
  /home/noob/soundcloud/src/include/database/database.cpp:31:46: error: expected ‘;’ before ‘:’ token
  /home/noob/soundcloud/src/include/database/database.cpp:31:46: error: expected primary-expression before ‘:’ token
  /home/noob/soundcloud/src/include/database/database.cpp:31:46: error: expected ‘)’ before ‘:’ token
  /home/noob/soundcloud/src/include/database/database.cpp:31:46: error: expected primary-expression before ‘:’ token
  make[2]: *** [src/include/database/CMakeFiles/database.dir/database.cpp.o] Error 1
  make[1]: *** [src/include/database/CMakeFiles/database.dir/all] Error 2
  make: *** [all] Error 2
  </code></pre>