Home Help Center

Sequence Iterator Error Message?

eric.hilleric.hill Member Eric HillOrganization: Pioneer Balloon Co.Project: Internal Research
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

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    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
  • eric.hilleric.hill Member Eric HillOrganization: Pioneer Balloon Co.Project: Internal Research
    Thanks

    Well duh. :rolleyes:

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

    Thanks!
Sign In or Register to comment.