Archived

This forum has been archived. Please start a new discussion on GitHub.

Sequence Iterator Error Message?

I'm trying to iterate over a sequence passed to a servant and getting a compiler error:
c:\projects\pdfrenderer\slice\rendereri.cpp(14) : error C2440: 'initializing' : cannot convert from 'std::_Vector_const_iterator<_Ty,_Alloc>' to 'std::_Vector_iterator<_Ty,_Alloc>'

The slice definition is pretty trivial:
...
	sequence<byte> ByteSeq;
	
	struct File {
		string name;
		ByteSeq contents;
	};
	
	sequence<File> FileSeq;
...

And the code I'm using is:
void
RendererLib::RenderSvcI::Render(
	const ::RendererLib::Packet& workpacket,
	const Ice::Current& current)
{
	const RendererLib::FileSeq& files = workpacket.what;
	RendererLib::FileSeq::iterator file = files.begin(); [B]// Error here[/B]
	while (file_itor != workpacket.what.end()) {
		File afile = *file_itor;
	}
}

What's the right way to iterate over an Ice sequence?

Comments

  • bernard
    bernard Jupiter, FL
    Your C++ compiler reports the problem: you're trying to assign a const_iterator into an iterator. You should declare file as a RendererLib::FileSeq::const_iterator .

    Cheers,
    Bernard
  • Thanks

    Well duh. :rolleyes:

    I need to go home and get some rest. Sigh.

    Thanks!