[filesystem 1.34] no matching function for call to 'is_separator' ...

When trying to compile this (tester.cpp): #include <boost/filesystem/path.hpp> int main(int argc, char *argv[]) { boost::filesystem::path path1( "some/path" ); boost::filesystem::path path2; path2.append( path1.begin(), path1.end() ); } like this:
g++ -o tester tester.cpp -L/usr/local/lib -lboost_filesystem-d-1_34
g++ --version i686-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build
g++ --version
-I/usr/local/include/boost-1_34 with this: 5247) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. or this: powerpc-apple-darwin8-g++-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5247) Copyright (C) 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. I get this: /usr/local/include/boost-1_34/boost/filesystem/path.hpp: In member function 'boost::filesystem::basic_path<String, Traits>& boost::filesystem::basic_path<String, Traits>::append(InputIterator, InputIterator) [with InputIterator = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, String = std::string, Traits = boost::filesystem::path_traits]': tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1002: error: no matching function for call to 'is_separator(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1002: error: no matching function for call to 'is_separator(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1002: error: no match for 'operator==' in '((boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>*)(& boost::operator+(const boost::iterator_facade<Derived1, V1, TC1, R1, D1>&, typename Derived::difference_type) [with Derived = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, V = const std::string, TC = boost::bidirectional_traversal_tag, R = const std::string&, D = ptrdiff_t](2)))->boost::iterator_facade<I, V, TC, R, D>::operator* [with Derived = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, Value = const std::string, CategoryOrTraversal = boost::bidirectional_traversal_tag, Reference = const std::string&, Difference = ptrdiff_t]() == boost::filesystem::colon<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits> >::value' tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1007: error: no matching function for call to 'is_separator(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1011: error: no match for 'operator&&' in 'boost::operator!= [with Derived1 = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, V1 = const std::string, TC1 = boost::bidirectional_traversal_tag, R1 = const std::string&, D1 = ptrdiff_t, Derived2 = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, V2 = const std::string, TC2 = boost::bidirectional_traversal_tag, R2 = const std::string&, D2 = ptrdiff_t](((const boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>&)((const boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>*)((boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>*)(& first)))), ((const boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>&)((const boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>*)((boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>*)(& last))))) && ((boost::iterator_facade<boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, const std::string, boost::bidirectional_traversal_tag, const std::string&, ptrdiff_t>*)(& first))->boost::iterator_facade<I, V, TC, R, D>::operator* [with Derived = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, Value = const std::string, CategoryOrTraversal = boost::bidirectional_traversal_tag, Reference = const std::string&, Difference = ptrdiff_t]()' /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1011: note: candidates are: operator&&(bool, bool) <built-in> tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1011: error: no matching function for call to 'boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::m_append(const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' /usr/local/include/boost-1_34/boost/filesystem/path.hpp:959: note: candidates are: void boost::filesystem::basic_path<String, Traits>::m_append(typename String::value_type) [with String = std::string, Traits = boost::filesystem::path_traits] /usr/local/include/boost-1_34/boost/iterator/iterator_facade.hpp: In static member function 'static void boost::iterator_core_access::advance(Facade&, typename Facade::difference_type) [with Facade = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator]': /usr/local/include/boost-1_34/boost/iterator/iterator_facade.hpp:695: instantiated from 'Derived& boost::iterator_facade<I, V, TC, R, D>::operator+=(Difference) [with Derived = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, Value = const std::string, CategoryOrTraversal = boost::bidirectional_traversal_tag, Reference = const std::string&, Difference = ptrdiff_t]' /usr/local/include/boost-1_34/boost/filesystem/path.hpp:1004: instantiated from 'boost::filesystem::basic_path<String, Traits>& boost::filesystem::basic_path<String, Traits>::append(InputIterator, InputIterator) [with InputIterator = boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator, String = std::string, Traits = boost::filesystem::path_traits]' tester.cpp:7: instantiated from here /usr/local/include/boost-1_34/boost/iterator/iterator_facade.hpp:547: error: 'class boost::filesystem::basic_path<std::string, boost::filesystem::path_traits>::iterator' has no member named 'advance' I get similar errors when building with g++ 3.3. Any ideas?

Well, it seems I've answered my own question. The similarity of the interface to std::basic_string led me to believe that what I was attempting was possible. But the fundamental difference is that basic_string _is_ a container of characters (the type returned when its iterators are dereferenced), but basic_path only _pretends to be_ a container of path elements (strings) which is what is returned when its iterators are dereferenced. Might I humbly suggest something along the lines of the following? template<class String, class Traits> basic_path<String, Traits> & basic_path<String, Traits>::append( iterator first, iterator last ) { assert( first.m_path_ptr == last.m_path_ptr ); m_path.append( first.m_path_ptr->m_path.begin() + first.m_pos, last.m_path_ptr->m_path.begin() + last.m_pos ); return *this; } Declared in the class thus: class iterator; basic_path & append( iterator first, iterator last );
participants (1)
-
David Whetstone