www.digitalmars.com         C & C++   DMDScript  

c++.stlsoft - compile error from auto_buffer::const_reverse_iterator

reply Steven <kuaf.lee gmail.com> writes:
I tested code snippet below, and VC6 compile report compile error.
////////////////////////////////////////////////////////////////
// code snippet
{
        typedef stlsoft::auto_buffer<int> buffer_t;
        buffer_t buff(20);
        int M=20;
        for (buffer_t::iterator iter = buff.begin(); iter != buff.end();
++iter) {
            *iter = M--;            
        } 
        for (buffer_t::const_reverse_iterator const_riter = (/*(const
buffer_t&)*/buff).rbegin(); const_riter != (/*(const buffer_t&)*/buff).rend();
++const_riter) {
            ;           
        }       
    }

// compile error from VC6
example.winstl.filesystem.findfile_sequence.cpp
d:\codebase\stlsoft\stlsoft-1.10-alpha-12-delta\examples\winstl\filesystem\example.winstl.filesystem.findfile_sequence\example.winstl.filesystem.findf
le_sequence.cpp(73) : error C2440: 'initializing' : cannot convert from 'struct
stlsoft::reverse_i
terator_base<int *,int,int &,int *,int>' to 'struct
stlsoft::const_reverse_iterator_base<int const *,int const ,int const &,int
const *,int>'
        No constructor could take the source type, or constructor overload
resolution was ambiguous
d:\codebase\stlsoft\stlsoft-1.10-alpha-12-delta\examples\winstl\filesystem\example.winstl.filesystem.findfile_sequence\example.winstl.filesystem.findf
le_sequence.cpp(73) : error C2678: binary '!=' : no operator defined which
takes a left-hand opera
nd of type 'struct stlsoft::const_reverse_iterator_base<int const *,int const
,int const &,int const *,int>' (or there is no acceptable conversion)
Error executing cl.exe.

example.winstl.filesystem.findfile_sequence.obj - 2 error(s), 0 warning(s)

////////////////////////////////////////////////////////////////
As we known, auto_buffer has overload rbegin() for const_reverse_iterator, I
wonder why produce such error? 

Thanks.
Dec 30 2009
parent "Matt Wilson" <matthewwilson acm.org> writes:
Steven

This has been a known defect for quite some time, but it's never been fixed 
because (i) I was intending to address this with STLSoft 1.9 (and I was 
expecting that to be done a couple of years ago!), and (ii) I thought fixing 
it in 1.8 would take too much effort.

Turns out I was wrong on both: I've just spent a cpl hours and have made it 
work for 1.8 (with VC++ 6 & 9, GCC 3.4 and Borland 5.6).

I've added an item to the project tracker - 
https://sourceforge.net/tracker/?func=detail&aid=2926633&group_id
238860&atid=1107746 - 
which you can monitor for progress, but I should hope to have a new STLSoft 
release by the coming w/e.

Thanks for raising my attention to this matter again.

May I ask: how did you hear about STLSoft, and what are you using it for?

Cheers

Matt



"Steven" <kuaf.lee gmail.com> wrote in message 
news:hhf6qk$2prp$1 digitalmars.com...
I tested code snippet below, and VC6 compile report compile error.
 ////////////////////////////////////////////////////////////////
 // code snippet
 {
        typedef stlsoft::auto_buffer<int> buffer_t;
        buffer_t buff(20);
        int M=20;
        for (buffer_t::iterator iter = buff.begin(); iter != buff.end(); 
 ++iter) {
            *iter = M--;
        }
        for (buffer_t::const_reverse_iterator const_riter = (/*(const 
 buffer_t&)*/buff).rbegin(); const_riter != (/*(const 
 buffer_t&)*/buff).rend(); ++const_riter) {
            ;
        }
    }

 // compile error from VC6
 example.winstl.filesystem.findfile_sequence.cpp
 d:\codebase\stlsoft\stlsoft-1.10-alpha-12-delta\examples\winstl\filesystem\example.winstl.filesystem.findfile_sequence\example.winstl.filesystem.findf
le_sequence.cpp(73) 
 : error C2440: 'initializing' : cannot convert from 'struct 
 stlsoft::reverse_i
 terator_base<int *,int,int &,int *,int>' to 'struct 
 stlsoft::const_reverse_iterator_base<int const *,int const ,int const 
 &,int const *,int>'
        No constructor could take the source type, or constructor overload 
 resolution was ambiguous
 d:\codebase\stlsoft\stlsoft-1.10-alpha-12-delta\examples\winstl\filesystem\example.winstl.filesystem.findfile_sequence\example.winstl.filesystem.findf
le_sequence.cpp(73) 
 : error C2678: binary '!=' : no operator defined which takes a left-hand 
 opera
 nd of type 'struct stlsoft::const_reverse_iterator_base<int const *,int 
 const ,int const &,int const *,int>' (or there is no acceptable 
 conversion)
 Error executing cl.exe.

 example.winstl.filesystem.findfile_sequence.obj - 2 error(s), 0 warning(s)

 ////////////////////////////////////////////////////////////////
 As we known, auto_buffer has overload rbegin() for const_reverse_iterator, 
 I wonder why produce such error?

 Thanks.
 
Jan 05 2010