<html><head></head><body><div dir="auto">Try changing your begin and end iterator types to const, e.g.<br><br>sword::ConfigEntMap::const_iterator<br></div><br><br><div class="gmail_quote"><div dir="auto">On June 11, 2024 21:34:52 GMT+02:00, "David "Judah's Shadow" Blue" <yudahsshadow@gmx.com> wrote:</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail"><div dir="auto">On Monday, May 20, 2024 2:37:07 PM EDT David "Judah's Shadow" Blue wrote:<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">On Wednesday, May 15, 2024 9:01:14 AM EDT Troy A. Griffitts wrote:<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #ad7fa8; padding-left: 1ex;"><div dir="auto">Hi David,<br><br>Yeah, so a module's config is simply a multimap<SWBuf, SWBuf>. We<br>extend multimap with our own class multimapwithdefault to make it nice<br><br>to work with when there is only one entry so you can still simply say:<br> SWBuf x = configEntries["mykey"];<br><br>Just like a map works, but if there is more than one entry, for your key<br>(which is allowed by multimap) the behavior is undefined. You'll get<br>one of the entries, but not sure which one.<br><br>So, for cases when you want to read multiple entries for a key, you'll<br><br>have to use the standard multimap iterators, something like the <br>following:<br> ConfigEntMap::iterator begin =<br><br>module->getConfig().lower_bound("Feature");<br><br> ConfigEntMap::iterator end =<br><br>module->getConfig().upper_bound("Feature");<br><br> while (begin != end) {<br> <br> SWBuf featureValue = begin->second;<br> ++begin;<br> <br> }<br><br>Hope this helps,<br></div></blockquote><div dir="auto"><br>It does, however, when I try this I get errors about no viable overloaded<br>'='. I've tried both declaring my ConfigEntMap::iterators before hand and<br>assigning them in the declaration, the errors differ slightly, but it all<br>boils down to the compiler not being able to decide if it should be an<br>implicit copy or an implicit move. I assume it should be a copy, but I'm<br>not sure how to go about specifying that in the code.<br></div></blockquote><div dir="auto"><br>I've still not managed to get any headway on getting this to compile. Here's <br>my code:<br><br>If(this->mod->getConfigEntry("Feature") != NULL) {<br> sword::ConfigEntMap::iterator begin;<br> sword::ConfigEntMap::iterator end;<br><br> begin = this->mod->getConfig().lower_bound("Feature");<br> end = this->mod->getConfig().upper_bound("Feature");<br><br> while(begin != end) {<br> featureSet += "Feature: ";<br> featureSet += begin->second;<br> featureSet += "\n";<br> ++begin;<br> }<br>}<br><br>Where featureSet is a std::string.<br><br>And this is the output of the compiler.<br>[ 6%] Building CXX object CMakeFiles/bibish.dir/src/front/info.cpp.o<br>~/Projects/bibish/src/front/info.cpp: In member function ‘std::string <br>Info::getInfo()’:<br>~/Projects/bibish/src/front/info.cpp:63:61: error: no match for ‘operator=’ <br>(operand types are ‘std::multimap<sword::SWBuf, sword::SWBuf, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::iterator’ {aka ‘std::_Rb_tree<sword::SWBuf, std::pair<const <br>sword::SWBuf, sword::SWBuf>, std::_Select1st<std::pair<const sword::SWBuf, <br>sword::SWBuf> >, std::less<sword::SWBuf>, std::allocator<std::pair<const <br>sword::SWBuf, sword::SWBuf> > >::iterator’} and ‘std::multimap<sword::SWBuf, <br>sword::SWBuf, std::less<sword::SWBuf>, std::allocator<std::pair<const <br>sword::SWBuf, sword::SWBuf> > >::const_iterator’ {aka <br>‘std::_Rb_tree<sword::SWBuf, std::pair<const sword::SWBuf, sword::SWBuf>, <br>std::_Select1st<std::pair<const sword::SWBuf, sword::SWBuf> >, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::const_iterator’})<br> 63 | begin = this->mod->getConfig().lower_bound("Feature");<br> | ^<br>In file included from /usr/include/c++/13/map:62,<br> from /usr/include/sword/swmgr.h:60,<br> from ~/Projects/bibish/src/front/info.cpp:25:<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: candidate: <br>‘std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> >& <br>std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::operator=(const std::_Rb_tree_iterator<std::pair<const sword::SWBuf, <br></div></blockquote><div dir="auto">sword::SWBuf> >&)’<br> 256 | struct _Rb_tree_iterator<br> | ^~~~~~~~~~~~~~~~~<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: no known conversion for <br>argument 1 from ‘std::multimap<sword::SWBuf, sword::SWBuf, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::const_iterator’ {aka ‘std::_Rb_tree<sword::SWBuf, <br>std::pair<const sword::SWBuf, sword::SWBuf>, std::_Select1st<std::pair<const <br>sword::SWBuf, sword::SWBuf> >, std::less<sword::SWBuf>, <br>std::allocator<std::pair<const sword::SWBuf, sword::SWBuf> > <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::const_iterator’} to ‘const std::_Rb_tree_iterator<std::pair<const <br></div></blockquote><div dir="auto">sword::SWBuf, sword::SWBuf> >&’<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: candidate: <br>‘std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> >& <br>std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::operator=(std::_Rb_tree_iterator<std::pair<const sword::SWBuf, <br></div></blockquote><div dir="auto">sword::SWBuf> >&&)’<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: no known conversion for <br>argument 1 from ‘std::multimap<sword::SWBuf, sword::SWBuf, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::const_iterator’ {aka ‘std::_Rb_tree<sword::SWBuf, <br>std::pair<const sword::SWBuf, sword::SWBuf>, std::_Select1st<std::pair<const <br>sword::SWBuf, sword::SWBuf> >, std::less<sword::SWBuf>, <br>std::allocator<std::pair<const sword::SWBuf, sword::SWBuf> > <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::const_iterator’} to ‘std::_Rb_tree_iterator<std::pair<const sword::SWBuf, <br></div></blockquote><div dir="auto">sword::SWBuf> >&&’<br>~/Projects/bibish/src/front/info.cpp:64:59: error: no match for ‘operator=’ <br>(operand types are ‘std::multimap<sword::SWBuf, sword::SWBuf, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::iterator’ {aka ‘std::_Rb_tree<sword::SWBuf, std::pair<const <br>sword::SWBuf, sword::SWBuf>, std::_Select1st<std::pair<const sword::SWBuf, <br>sword::SWBuf> >, std::less<sword::SWBuf>, std::allocator<std::pair<const <br>sword::SWBuf, sword::SWBuf> > >::iterator’} and ‘std::multimap<sword::SWBuf, <br>sword::SWBuf, std::less<sword::SWBuf>, std::allocator<std::pair<const <br>sword::SWBuf, sword::SWBuf> > >::const_iterator’ {aka <br>‘std::_Rb_tree<sword::SWBuf, std::pair<const sword::SWBuf, sword::SWBuf>, <br>std::_Select1st<std::pair<const sword::SWBuf, sword::SWBuf> >, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::const_iterator’})<br> 64 | end = this->mod->getConfig().upper_bound("Feature");<br> | ^<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: candidate: <br>‘std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> >& <br>std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::operator=(const std::_Rb_tree_iterator<std::pair<const sword::SWBuf, <br></div></blockquote><div dir="auto">sword::SWBuf> >&)’<br> 256 | struct _Rb_tree_iterator<br> | ^~~~~~~~~~~~~~~~~<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: no known conversion for <br>argument 1 from ‘std::multimap<sword::SWBuf, sword::SWBuf, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::const_iterator’ {aka ‘std::_Rb_tree<sword::SWBuf, <br>std::pair<const sword::SWBuf, sword::SWBuf>, std::_Select1st<std::pair<const <br>sword::SWBuf, sword::SWBuf> >, std::less<sword::SWBuf>, <br>std::allocator<std::pair<const sword::SWBuf, sword::SWBuf> > <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::const_iterator’} to ‘const std::_Rb_tree_iterator<std::pair<const <br></div></blockquote><div dir="auto">sword::SWBuf, sword::SWBuf> >&’<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: candidate: <br>‘std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> >& <br>std::_Rb_tree_iterator<std::pair<const sword::SWBuf, sword::SWBuf> <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::operator=(std::_Rb_tree_iterator<std::pair<const sword::SWBuf, <br></div></blockquote><div dir="auto">sword::SWBuf> >&&)’<br>/usr/include/c++/13/bits/stl_tree.h:256:12: note: no known conversion for <br>argument 1 from ‘std::multimap<sword::SWBuf, sword::SWBuf, <br>std::less<sword::SWBuf>, std::allocator<std::pair<const sword::SWBuf, <br>sword::SWBuf> > >::const_iterator’ {aka ‘std::_Rb_tree<sword::SWBuf, <br>std::pair<const sword::SWBuf, sword::SWBuf>, std::_Select1st<std::pair<const <br>sword::SWBuf, sword::SWBuf> >, std::less<sword::SWBuf>, <br>std::allocator<std::pair<const sword::SWBuf, sword::SWBuf> > <br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 1ex 0.8ex; border-left: 1px solid #729fcf; padding-left: 1ex;"><div dir="auto">::const_iterator’} to ‘std::_Rb_tree_iterator<std::pair<const sword::SWBuf, <br></div></blockquote><div dir="auto">sword::SWBuf> >&&’<br>make[2]: *** [CMakeFiles/bibish.dir/build.make:258: CMakeFiles/bibish.dir/src/<br>front/info.cpp.o] Error 1<br>make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/bibish.dir/all] Error 2<br>make: *** [Makefile:136: all] Error 2<hr>sword-devel mailing list: sword-devel@crosswire.org<br><a href="http://crosswire.org/mailman/listinfo/sword-devel">http://crosswire.org/mailman/listinfo/sword-devel</a><br>Instructions to unsubscribe/change your settings at above page<br></div></pre></blockquote></div><div dir="auto"><div class='k9mail-signature'>-- <br>Sent from my Android device with K-9 Mail. Please excuse my brevity.</div></div></body></html>