std::reverse_bidirectional_iterator out of date?

T

twoeyedhuman1111

I'm trying to port somebodies code from microsl0th to (our good ol)
g++. He uses std::bidirectional_iterator_tag and it says it's
undefined when I include the libraries for it. Here is my sample code:
(not all of it) (of course, the other values have correct
implementations but don't worry about those) (just worry about
reverse_bidirectional_iterator

typedef std::reverse_bidirectional_iterator<iterator,
value_type, reference, pointer, difference_type>
reverse_iterator;

This is the error I get:
tree.cpp:187: error: ISO C++ forbids declaration of `
reverse_bidirectional_iterator' with no type

I included <memory>,<iterator>, and <cassert> but still get that error.
I even looked it up on google, and google said that
std:reverse_bidirectional_iterator is outdated, but SHOULD be included
in <iterator>

Any ideas as to how to get the implementation for
reverse_bidirectional_iterator?
 
P

P.J. Plauger

I'm trying to port somebodies code from microsl0th to (our good ol)
g++. He uses std::bidirectional_iterator_tag and it says it's
undefined when I include the libraries for it. Here is my sample code:
(not all of it) (of course, the other values have correct
implementations but don't worry about those) (just worry about
reverse_bidirectional_iterator

typedef std::reverse_bidirectional_iterator<iterator,
value_type, reference, pointer, difference_type>
reverse_iterator;

This is the error I get:
tree.cpp:187: error: ISO C++ forbids declaration of `
reverse_bidirectional_iterator' with no type

I included <memory>,<iterator>, and <cassert> but still get that error.
I even looked it up on google, and google said that
std:reverse_bidirectional_iterator is outdated, but SHOULD be included
in <iterator>

Any ideas as to how to get the implementation for
reverse_bidirectional_iterator?

If you were talking about Microsoft Visual C++, you could just
look at the header, but since you're not I can't help you.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
T

twoeyedhuman1111

Well, I'm trying to compile it on linux with g++, since if I can get it
to compile on linux, it will end up compiling just fine with mingw.
Perhaps I should browse <iterator> and see if it includes
std::reverse_bidirectional_iterator?
 
P

P.J. Plauger

Well, I'm trying to compile it on linux with g++, since if I can get it
to compile on linux, it will end up compiling just fine with mingw.

Modluo the underlying C library, yes.
Perhaps I should browse <iterator> and see if it includes
std::reverse_bidirectional_iterator?

It's certainly there in VC++. But to cut to the chase, you can
replace reverse_bidirectional_iterator with reverse_iterator
these days. Should work just fine.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
T

twoeyedhuman1111

Okay, thank you very much!!! You have given me inspiration to try and
debug this microsoft of a mess. :) I will try that!
 
T

twoeyedhuman1111

I get errors when I replace reverse_bidirectional_iterator with
reverse_iterator though. For this code:

typedef std::reverse_iterator<iterator,
value_type, reference, pointer, difference_type>
reverse_iterator;
typedef std::reverse_iterator<const_iterator,
value_type, const_reference, const_pointer, difference_type>
const_reverse_iterator;

typedef std::reverse_iterator<child_iterator,
value_type, reference, pointer, difference_type>
reverse_child_iterator;
typedef std::reverse_iterator<const_child_iterator,
value_type, const_reference, const_pointer, difference_type>
const_reverse_child_iterator;

It says:
tree.cpp:187: error: wrong number of template arguments (5, should be
1)
/usr/include/c++/3.3/bits/stl_iterator.h:91: error: provided for `
template<class _Iterator> class std::reverse_iterator'
tree.cpp:187: error: ISO C++ forbids declaration of `reverse_iterator'
with no
type
tree.cpp:190: error: wrong number of template arguments (5, should be
1)
/usr/include/c++/3.3/bits/stl_iterator.h:91: error: provided for `
template<class _Iterator> class std::reverse_iterator'
tree.cpp:190: error: ISO C++ forbids declaration of
`const_reverse_iterator'
with no type
tree.cpp:194: error: wrong number of template arguments (5, should be
1)
/usr/include/c++/3.3/bits/stl_iterator.h:91: error: provided for `
template<class _Iterator> class std::reverse_iterator'
tree.cpp:194: error: ISO C++ forbids declaration of
`reverse_child_iterator'
with no type
tree.cpp:197: error: wrong number of template arguments (5, should be
1)
/usr/include/c++/3.3/bits/stl_iterator.h:91: error: provided for `
template<class _Iterator> class std::reverse_iterator'
tree.cpp:197: error: ISO C++ forbids declaration of `
const_reverse_child_iterator' with no type

I know that I'm passing the wrong number of arguments, but with
reverse_iterator, can I still put in all the information I have above?
 
P

P.J. Plauger

Okay, thank you very much!!! You have given me inspiration to try and
debug this microsoft of a mess. :) I will try that!

A word of advice: you will get much better help if you drop
the adolescent habit of slamming vendors. You began this thread
with:

: I'm trying to port somebodies code from microsl0th to (our good ol)
: g++.

and now you've continued it with the remark above. FYI, I'm the
guy who wrote the Standard C++ library shipped with VC++. It's
thus very easy for me to take personally any implications that
the resulting product is either slothful or messy.

Now it so happens that I'm also about the best person around to
answer your questions and give you economical guidance in solving
your problem. I've chose to do so twice despite the fact that
you're being a twit. But I see that you have a posting following
this one asking for more assistance. You can answer your own
question by reading the library headers. I could save you a few
minutes by telling you the answer yet again, but this time I
choose not to.

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top