[Boost-users] [filesystem] iterator VC 10.0

2 views
Skip to first unread message

Commander Pirx

unread,
May 17, 2010, 4:14:10 PM5/17/10
to boost...@lists.boost.org
Hi,
I tried to compile the following lines with VC 10:

void path_adapter::convert( const boost::filesystem::path& p)
{
typedef boost::filesystem::path::const_iterator const_path_iterator;
for (const_path_iterator pos = p.begin(); pos < p.end(); ++pos)
{
//...
}
}

and got the error: error C2039: 'distance_to': is not an element of
'boost::filesystem::basic_path<String,Traits>::iterator'

Seems to be a problem of the new iterator facade implementation. I had
no trouble with this method until Boost 1.43.0. Any idea how to fix this?

Pirx!

_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

--
You received this message because you are subscribed to the Google Groups "BOOST Archives" group.
To post to this group, send email to boost...@googlegroups.com.
To unsubscribe from this group, send email to boost-list+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/boost-list?hl=en.

Steven Watanabe

unread,
May 17, 2010, 4:28:55 PM5/17/10
to boost...@lists.boost.org
AMDG

Commander Pirx wrote:
> I tried to compile the following lines with VC 10:
>
> void path_adapter::convert( const boost::filesystem::path& p)
> {
> typedef boost::filesystem::path::const_iterator const_path_iterator;
> for (const_path_iterator pos = p.begin(); pos < p.end(); ++pos)
> {
> //...
> }
> }
>
> and got the error: error C2039: 'distance_to': is not an element of
> 'boost::filesystem::basic_path<String,Traits>::iterator'
>
> Seems to be a problem of the new iterator facade implementation. I had
> no trouble with this method until Boost 1.43.0. Any idea how to fix this?

path iterators are only bidirectional iterators. This has always been
the case (I checked back to 1.33.1). Try comparing using !=.

In Christ,
Steven Watanabe

Commander Pirx

unread,
May 17, 2010, 5:59:07 PM5/17/10
to boost...@lists.boost.org
>> I tried to compile the following lines with VC 10:
>>
>> void path_adapter::convert( const boost::filesystem::path& p)
>> {
>> typedef boost::filesystem::path::const_iterator const_path_iterator;
>> for (const_path_iterator pos = p.begin(); pos < p.end(); ++pos)
>> {
>> //...
>> }
>> }
>>
>> and got the error: error C2039: 'distance_to': is not an element of
>> 'boost::filesystem::basic_path<String,Traits>::iterator'
>>
>> Seems to be a problem of the new iterator facade implementation. I had
>> no trouble with this method until Boost 1.43.0. Any idea how to fix this?
>
> path iterators are only bidirectional iterators. This has always been
> the case (I checked back to 1.33.1). Try comparing using !=.
>
> In Christ,
> Steven Watanabe

You're right. My fault. The original error was a problem with
std::for_each() in conjunction with boost::bind. But currently I have no
simple piece of code to reproduce this error.

Pirx!
Reply all
Reply to author
Forward
0 new messages