You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by as...@apache.org on 2024/02/09 23:30:02 UTC

(arrow) branch main updated: GH-40009: [C++] Add missing "#include " (#40010)

This is an automated email from the ASF dual-hosted git repository.

assignuser pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 990e475618 GH-40009: [C++] Add missing "#include <algorithm>" (#40010)
990e475618 is described below

commit 990e4756183cfa9e69236aeb0af7aeb5f70f1978
Author: Sutou Kouhei <ko...@clear-code.com>
AuthorDate: Sat Feb 10 08:29:55 2024 +0900

    GH-40009: [C++] Add missing "#include <algorithm>" (#40010)
    
    ### Rationale for this change
    
    `std::find()` is defined in `<algorithm>`. If we don't include `<algorithm>` explicitly, g++-14 complains:
    
        cpp/src/arrow/filesystem/util_internal.cc: In function 'arrow::Result<std::__cxx11::basic_string<char> > arrow::fs::internal::PathFromUriHelper(const std::string&, std::vector<std::__cxx11::basic_string<char> >, bool, AuthorityHandlingBehavior)':
        cpp/src/arrow/filesystem/util_internal.cc:143:16: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, const std::__cxx11::basic_string<char>&)'
          143 |   if (std::find(supported_schemes.begin(), supported_schemes.end(), scheme) ==
              |       ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
          435 |     find(istreambuf_iterator<_CharT> __first,
              |     ^~~~
        /usr/include/c++/14/bits/streambuf_iterator.h:435:5: note:   template argument deduction/substitution failed:
        cpp/src/arrow/filesystem/util_internal.cc:143:16: note:   '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
          143 |   if (std::find(supported_schemes.begin(), supported_schemes.end(), scheme) ==
              |       ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    ### What changes are included in this PR?
    
    Include `<algorithm>` explicitly.
    
    ### Are these changes tested?
    
    Yes.
    
    ### Are there any user-facing changes?
    
    No.
    * Closes: #40009
    
    Authored-by: Sutou Kouhei <ko...@clear-code.com>
    Signed-off-by: Jacob Wujciak-Jens <ja...@wujciak.de>
---
 cpp/src/arrow/filesystem/util_internal.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpp/src/arrow/filesystem/util_internal.cc b/cpp/src/arrow/filesystem/util_internal.cc
index 1ca5af27fc..13f43d45db 100644
--- a/cpp/src/arrow/filesystem/util_internal.cc
+++ b/cpp/src/arrow/filesystem/util_internal.cc
@@ -17,6 +17,7 @@
 
 #include "arrow/filesystem/util_internal.h"
 
+#include <algorithm>
 #include <cerrno>
 
 #include "arrow/buffer.h"