Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 632
  • Last Modified:

Compiler Error C2825: cannot form a qualified name, NEEDS EXPLAINING

I get this error:

c:\work\orc\all_orc_projects\STLport-4.5.3\stlport\stl\_iterator_base.h(82) : error C2825: '_Iterator::iterator_category': cannot form a qualified name
        c:\work\orc\all_orc_projects\osprey1.0\be\opt\opt_cfg_trans.h(100) : see reference to class template instantiation '_STL::iterator_traits<_Iterator>' being compiled
        with
        [
            _Iterator=cluster_vector<edge,_STL::select1st<edge>>::fast_iterator
        ]
        c:\work\orc\all_orc_projects\osprey1.0\be\opt\opt_cfg_trans.cxx(198) : see reference to class template instantiation 'composite_iterator<Cluster_iterator,Fast_iterator>' being compiled
        with
        [
            Cluster_iterator=cluster_vector<edge,_STL::select1st<edge>>::cluster_iterator,
            Fast_iterator=cluster_vector<edge,_STL::select1st<edge>>::fast_iterator
        ]
--------------------------------------------------------------
The source lines pointed to are:

_iterator_base.h(82):
template <class _Iterator>
struct iterator_traits {
  typedef typename _Iterator::iterator_category iterator_category;
...
};


opt_cfg_trans.h(100):
template <class Cluster_iterator, class Fast_iterator>
class composite_iterator {
public:
...
  typedef typename iterator_traits<Fast_iterator>::value_type      value_type;
...
}

opt_cfg_trans.cxx(198):  (IT ALL STARTS HERE !!!)
for (successor_graph::iterator e = g.begin(); e != g.end(); ++e)
{ ... }

where :
typedef cluster_vector<edge, select1st<edge> > successor_graph;

This is cluster vector:
template <class T, class IndexFunction>
class cluster_vector {
public:
  typedef typename IndexFunction::result_type cluster_id;
  typedef T value_type;
  typedef IndexFunction index_function;
  typedef cluster_vector<T, IndexFunction> self;
  typedef vector<value_type> cluster_type;
  typedef cluster_type::iterator      fast_iterator;
  typedef cluster_type::size_type     size_type;
  typedef vector<cluster_type>        cluster_container;
  typedef cluster_container::iterator cluster_iterator;
  typedef composite_iterator<cluster_iterator, fast_iterator> iterator;
...
}

and this is composite_iterator:

template <class Cluster_iterator, class Fast_iterator>
class composite_iterator {
public:
  typedef composite_iterator<Cluster_iterator, Fast_iterator> self;
  typedef forward_iterator_tag iterator_category;
  typedef typename iterator_traits<Fast_iterator>::value_type      value_type;
  typedef typename iterator_traits<Fast_iterator>::difference_type
          difference_type;
  typedef typename iterator_traits<Fast_iterator>::pointer         pointer;
  typedef typename iterator_traits<Fast_iterator>::reference       reference;
...
}

--------------------------------------------------------------
What do I miss ???
0
eladho
Asked:
eladho
  • 12
  • 9
  • 2
  • +1
1 Solution
 
Zlatin ZlatevTechnical ArchitectCommented:
0
 
eladhoAuthor Commented:
Well, I read this a million times, but I just don't understand what this error is all about.
Can you/anyone please explain that in simple english?
Even better- how does that error relate to my code?
0
 
Zlatin ZlatevTechnical ArchitectCommented:
What about changing
_iterator_base.h(82):
template <class _Iterator>
struct iterator_traits {
 typedef typename _Iterator::iterator_category iterator_category;
...
};

with
_iterator_base.h(82):
template <class _Iterator>
struct iterator_traits {
 typedef typename _Iterator::~iterator_category iterator_category;
...
};

0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
eladhoAuthor Commented:
I thought so myself, but it doesn't help:

c:\work\orc\all_orc_projects\STLport-4.5.3\stlport\stl\_iterator_base.h(82) : error C2523: '<Unknown>::~iterator_category' : destructor tag mismatch

My biggest problem is that I just don't understand what the original error is all about, and therefore- I cannot tackle it...
0
 
Zlatin ZlatevTechnical ArchitectCommented:
@eladho, I cannot check your code via CS compiler, but according to me (as I have read your question carefully)
Your problem seems to be with this "_Iterator" before the "::" in line
 typedef typename _Iterator::iterator_category iterator_category;

What do you want to achieve?
0
 
Zlatin ZlatevTechnical ArchitectCommented:
Check whether this article about templates will be of any value for you:
http://jamesthornton.com/eckel/TICPP-2nd-ed-Vol-two/Chapter03.html
0
 
Zlatin ZlatevTechnical ArchitectCommented:
Well what about changing the type name, e.g.:

typedef typename _Iterator::iterator_category cls_iterator_category; //cls_ is added to make difference



0
 
eladhoAuthor Commented:
Sorry for stalling with the answer. Well- changing the name doesn't help, though I have a strong feeling something as easy as that should solve the problem.
What is the nature of the error in Microsoft's example:

// C2825.cpp
typedef int i;
int main() {
   int* p = new int;
   p->i::i();   // C2825
   // try the following line instead
   // p->i::~i();
}

What seems to cause an error in the line p->i::i();  ?
I think getting to the bottom of it will help me a lot to figure the problem in my case.

Elad.


0
 
Zlatin ZlatevTechnical ArchitectCommented:
@eladho, What about posting this in C# TA?
0
 
eladhoAuthor Commented:
Zlatev, thanx very much for your help.
It appears that I had a problem with the way <vector> was defined (I use 'stlport' as a portable stl library) and apparently, the only way my code compiled is under their debug mode (defining _STLP_DEBUG in case you ever wanna use it).
So, a big mess over stupid stuff. Thanx for the willingness to help !!!!!
0
 
Zlatin ZlatevTechnical ArchitectCommented:
So I suppose you have solved this yourself?
0
 
eladhoAuthor Commented:
Yes :-)
0
 
Zlatin ZlatevTechnical ArchitectCommented:
0
 
eladhoAuthor Commented:
What does that mean?
If you want the points, just say so and they are yours as you most certainly deserve them for devotion.
0
 
Zlatin ZlatevTechnical ArchitectCommented:
No, no, no - I have asked that you will be refunded your points - just because you have posted your solution.

If you wish to assign me some of them, you can leave comment for the moderators, for example to reduce the points, and to assign me the rest.
0
 
eladhoAuthor Commented:
Ahhh, thanx :-)
How and where do I leave a comment for the moderators?
0
 
NetminderCommented:
User resolved; points refunded and question closed.

eladho,

Please see http://www.cityofangels.com/Experts/Member.htm and http://www.cityofangels.com/Experts/Closing.htm

Netminder
EE Admin
0
 
Zlatin ZlatevTechnical ArchitectCommented:
Eladho, if you like my comments and want to give me some points, you can post "points for" question like it is described in http://www.cityofangels.com/Experts/Closing.htm#3

Note that I do not want or push you to do so - it is your decision.

Kind Regards,
Zlatin Zlatev
0
 
Zlatin ZlatevTechnical ArchitectCommented:
NetMinder, what about creating a FAQ page that is available through link under the EE member name, that will contain the links you have posted above?
0
 
NetminderCommented:
zlatev,

My understanding is that after the Engineering boys have finished the rewrite, they'll do something like that. In the meantime, because we have so many new members, and because many of the links in the various EE pages are no longer valid, we've used some space donated by a friend of mine to at least try and give people SOME direction.

Netminder
0
 
Zlatin ZlatevTechnical ArchitectCommented:
OK, I see.
0
 
eladhoAuthor Commented:
Thanx all.
"points for" question added:
http://www.experts-exchange.com/Community_Support/Q_20583527.html

eladho.
0
 
moduloCommented:
Dear eladho,

You can post a "Points for zlatev" Q in this topic area.

Please:
1) Post the link to the original Q in the "Points for zlatev" and
2) Add in the original Q a comment with the link to the "Points for zlatev", thus the email notif will warn zlatev.

modulo

Community Support Moderator
Experts Exchange
0
 
eladhoAuthor Commented:
0

Featured Post

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

  • 12
  • 9
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now