This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc, 'discards qualifers' error using templates


Hi all.

I'm having a problem when compiling code for an embedded Linux
platform (I'm limited to using gcc 2.95.3) and was hoping somebody could
offer some ideas on the matter... 

I get the 'discards qualifers' error when running gcc. The entir error message 
and an extract of the code is included.

The code compiles and runs perfectly with MS (yes I actually wrote it out loud) 
Visual C++ 6.0. 

Any help would be much appreciated.

   Sincerly Ulf

--------------------------
ERROR message:

passing `const P_LOOP_UNIT_DEFS' as `this' argument of
`struct _STL::pair<_STL::_Rb_tree_iterator<CLoopUnitDef *,_STL::_Const_traits<CLoopUnitDef *> >,bool> _STL::set<CLoopUnitDef *,_STL::less<CLoopUnitDef *>,_STL::allocator<CLoopUnitDef *> >
::insert(CLoopUnitDef *const &)'  discards qualifiers

------------------------
CODE:

#include <set>
using namespace std;

class CLoopUnitDef
{
	...
};

typedef set<CLoopUnitDef*> P_LOOP_UNIT_DEFS;

class CZoneDef
{
	...
public:	
	int m_zone;
	P_LOOP_UNIT_DEFS m_loopUnitDefs;
};
typedef set<CZoneDef> ZONE_DEFS;


class CConfiguration
{
public:
	...
	bool GetXmlDef(CStdString defFile)
	{
		...
		if(m_zoneDefs.size() && m_loopUnitDefs.size())
		{
			for(P_LOOP_UNIT_DEFS::iterator it=m_loopUnitDefs.begin(); it != m_loopUnitDefs.end(); it++)
			{
				ZONE_DEFS::iterator itZ = m_zoneDefs.find((*it)->m_zone);

				if(itZ != m_zoneDefs.end())
					itZ->m_loopUnitDefs.insert(*it); //ERROR
			}				
		}
	};

private:
	ZONE_DEFS m_zoneDefs;
	P_LOOP_UNIT_DEFS m_loopUnitDefs;
};


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]