[assign] MinGW list_of() set<string> problem

The following used to compile: std::set<std::string> const virtual_control::s_unbindables_permanent = boost::assign::list_of("Escape")("PrintScreen"); I'm not sure why, as Boost.Assign's docs seem to say I should have had to use the to_adapter function. Anyway, I recently started getting the following error: E:/libs/boost/boost/assign/list_of.hpp: In member function `boost::assign_detail::generic_list<char[7]>::operator set<string>() const' : E:\code\cpp\dasc\wc2\lib\alex\src\virtual_control.cpp:413: instantiated from here E:/libs/boost/boost/assign/list_of.hpp:334: error: call of overloaded `set( const boost::assign_detail::converter< boost::assign_detail::generic_list<const char *> > & )' is ambiguous After changing my code to std::set<std::string> const virtual_control::s_unbindables_permanent = boost::assign::list_of("Escape")("PrintScreen").to_adapter(); I now get the different error E:/libs/boost/boost/assign/list_of.hpp: In member function `set< string > boost::assign_detail::converter< boost::assign_detail::generic_list<const char *> >::convert_to_adapter(const set<string> *) const': E:/libs/boost/boost/assign/list_of.hpp:200: instantiated from `boost::assign_detail::converter< boost::assign_detail::generic_list<const char *> >::adapter_converter::operator set<string>() const' E:\code\cpp\dasc\wc2\lib\alex\src\virtual_control.cpp:413: instantiated from here E:/libs/boost/boost/assign/list_of.hpp:179: error: 'class set<string>' has no member named 'push' To me, this looks like an error in Boost.Assign. Am I doing something wrong? Thanks, -- Daniel Schlyder http://bitblaze.com/

Sorry. I meant to send this to the users lists. Although, if it's a library bug, I guess this list would be OK too. -- Daniel Schlyder http://bitblaze.com/

"Daniel Schlyder" <daniel@bitblaze.com> wrote in message news:288373781.20050330073356@bitblaze.com... | The following used to compile: | | std::set<std::string> const virtual_control::s_unbindables_permanent | = boost::assign::list_of("Escape")("PrintScreen"); | | I'm not sure why, as Boost.Assign's docs seem to say I should have had to | use the to_adapter function. Anyway, I recently started getting the | following error: | | E:/libs/boost/boost/assign/list_of.hpp: In member function | `boost::assign_detail::generic_list<char[7]>::operator set<string>() const' hm..is this from a cvs snapshot? If so, please update. | E:\code\cpp\dasc\wc2\lib\alex\src\virtual_control.cpp:413: instantiated from | here | E:/libs/boost/boost/assign/list_of.hpp:334: error: call of overloaded | `set( | const boost::assign_detail::converter< | boost::assign_detail::generic_list<const char *> | > & | )' is ambiguous | | After changing my code to | | std::set<std::string> const virtual_control::s_unbindables_permanent | = boost::assign::list_of("Escape")("PrintScreen").to_adapter(); what is the virtual_control::s__xxxxxxxxxx ? Why don't you write const std::set<std::string> foo = ...: | I now get the different error | | E:/libs/boost/boost/assign/list_of.hpp: In member function | `set< | string | > boost::assign_detail::converter< | boost::assign_detail::generic_list<const char *> | >::convert_to_adapter(const set<string> *) const': | E:/libs/boost/boost/assign/list_of.hpp:200: instantiated from | `boost::assign_detail::converter< | boost::assign_detail::generic_list<const char *> | >::adapter_converter::operator set<string>() const' | E:\code\cpp\dasc\wc2\lib\alex\src\virtual_control.cpp:413: instantiated from | here | E:/libs/boost/boost/assign/list_of.hpp:179: error: 'class set<string>' has no | member named 'push' | | To me, this looks like an error in Boost.Assign. Am I doing something wrong? hm...don't call to adapter unless you are dealing with an adapter (queue, priority_queue, stack). Read about to_container() instead. -Thorsten

Thorsten Ottosen:
hm..is this from a cvs snapshot? If so, please update.
No, I'm using CVS HEAD. I just updated and recompiled with the same result. I'm using MinGW GCC 3.4.2, BTW, sorry for not mentioning before.
what is the virtual_control::s__xxxxxxxxxx ? Why don't you write
const std::set<std::string> foo = ...:
s_unbindables_permanent is a static variable in a class named virtual_control.
hm...don't call to adapter unless you are dealing with an adapter (queue, priority_queue, stack).
Oh, I'm not much of a C++ expert, as I'm sure you understand. ;) Didn't know the difference between a container and a container adapter.
Read about to_container() instead.
Thanks. Using it, the code compiles. I see it's mentioned as being a workaround. Is it really needed for GCC 3.4.2? Why then did it work before? (Not sure when I last worked on this code, might be as long as a month ago. I can try to find out exactly when it stopped working (the CVS date, I mean) if that would be useful.) Thanks for your help, -- Daniel Schlyder http://bitblaze.com/

"Daniel Schlyder" <daniel@bitblaze.com> wrote in message news:12236559906.20050330152342@bitblaze.com... | Thorsten Ottosen: | > hm..is this from a cvs snapshot? If so, please update. | | No, I'm using CVS HEAD. I just updated and recompiled with the same result. | I'm using MinGW GCC 3.4.2, BTW, sorry for not mentioning before. | | > what is the virtual_control::s__xxxxxxxxxx ? Why don't you write | > | > const std::set<std::string> foo = ...: | | s_unbindables_permanent is a static variable in a class named | virtual_control. ok. | > hm...don't call to adapter unless you are dealing with an adapter (queue, | > priority_queue, stack). | | Oh, I'm not much of a C++ expert, as I'm sure you understand. ;) Didn't know | the difference between a container and a container adapter. | | > Read about to_container() instead. | | Thanks. Using it, the code compiles. I see it's mentioned as being a | workaround. Is it really needed for GCC 3.4.2? Why then did it work before? yeah, good question. I will ahve to look into this...sometime... the regresion tests shown that list_of don't work too well with gcc. | (Not sure when I last worked on this code, might be as long as a month ago. | I can try to find out exactly when it stopped working (the CVS date, I mean) | if that would be useful.) I would be worth knowing if the old boost.1.32 code worked with your compiler. -Thorsten

Thorsten Ottosen:
I would be worth knowing if the old boost.1.32 code worked with your compiler.
It did. So did CVS dated 2005-03-15 00:00:00Z. -- Daniel Schlyder http://bitblaze.com/

"Daniel Schlyder" <daniel@bitblaze.com> wrote in message news:1042924625.20050330170947@bitblaze.com... | Thorsten Ottosen: | > I would be worth knowing if the old boost.1.32 code worked with your | > compiler. | | It did. So did CVS dated 2005-03-15 00:00:00Z. ok, very good to know. Thanks -Thorsten

Thorsten Ottosen:
"Daniel Schlyder" <daniel@bitblaze.com> wrote in message news:1042924625.20050330170947@bitblaze.com... | Thorsten Ottosen: | >> I would be worth knowing if the old boost.1.32 code worked with your | >> compiler. | | It did. So did CVS dated 2005-03-15 00:00:00Z.
ok, very good to know.
To be more specific, it's the changes in revision 1.16 of boost/assign/list_of.hpp that break my code. I've run into more trouble with the latest library version. Now that I have to use to_container(), it seems I can no longer use list_of() in function arguments. Ie., stuff like menu.push_back<option<unsigned> >("Unsigned Option", boost::assign::list_of<std::pair<unsigned, std::string> > (1, "One") (3, "Three") (5, "Five") (7, "Seven") (9, "Nine"), boost::bind(return_var<unsigned>, boost::cref(g_unsigned_option)), boost::bind(set_var<unsigned>, boost::ref(g_unsigned_option), _1) ); no longer compiles and I don't see how to fix it without creating a temporary object before the function call. :( -- Daniel Schlyder http://bitblaze.com/

"Daniel Schlyder" <daniel@bitblaze.com> wrote in message news:523436609.20050331081301@bitblaze.com... | Thorsten Ottosen: | > "Daniel Schlyder" <daniel@bitblaze.com> wrote in message | > news:1042924625.20050330170947@bitblaze.com... | > | Thorsten Ottosen: || >> I would be worth knowing if the old boost.1.32 code worked with your || >> compiler. | > | | > | It did. So did CVS dated 2005-03-15 00:00:00Z. | | > ok, very good to know. | | To be more specific, it's the changes in revision 1.16 of | boost/assign/list_of.hpp that break my code. | no longer compiles and I don't see how to fix it without creating a | temporary object before the function call. :( Ok, try using the new version of list_of in the cvs. The compiler was chokinng on ambiguities between base and derived class templated conversionoperators. Thanks for your help -Thorsten

Thorsten Ottosen:
Ok, try using the new version of list_of in the cvs. The compiler was chokinng on ambiguities between base and derived class templated conversionoperators.
Works great. Thank you! -- Daniel Schlyder http://bitblaze.com/
participants (2)
-
Daniel Schlyder
-
Thorsten Ottosen