Why I like the STL – NOT!

bloke

This is an error I got when compiling some code I wrote. Can you guess what the issue is?

error C2440: 'initializing' : cannot convert from 'class std::_Tree,class std::allocator >,struct std::pair,class std::allocator > const ,class std::map,class std::allocator > >,struct std::map ,class std::allocator >,class std::map,class std::allocator >,struct std::less,class std::allocator >

,class std::allocator,class std::allocator > > >::Kfn,struct std::less,class std::allocator > >,class std::allocator,class std::allocator > > >::iterator' to 'class std::Tree,class std:: allocator >,struct std::pair,class std::allocator > const ,class std::map,class std::allocator >,class CBufferFunc,s truct std::less,class std::allocator > >,class std::allocator > >,struct std::map,class std::allocator ,class std::map,class std::allocator >,class CBufferFunc,struct std::less,class std::allocator > >,class std::allocator >,struct std::less,class std::allocator > >,class std::allocator,class std::allocator >,class CBufferFunc,struct std::less,class std::allocator > >,class std::allocator > > >::_Kfn,struct std::less,class std::allocator > >,class std::allocator,class std::allocator >,class CBufferFunc,struct std::less,class std::allocator > >,class std::allocator > > >::iterator'

More for the answer: Answer: I had an iterator that that was getting initialized. I forgot to change the type when making some global changes, so it was a type mismatch on initialization.

Answer 2: C++’s choice of the STL was flawed since nobody can get this stuff right even in 2005.

Answer 3: Ah, what’s the point…

This entry was posted in General. Bookmark the permalink.

Leave a Reply

Your email address will not be published.