[uuid] - boost/algorithm/string.hpp - error no matching function for call to 'find(wchar_t [16], wchar_t* const&, wchar_t&)'

Hi, I found that the error no matching function for call to 'find(wchar_t [16], wchar_t* const&, wchar_t&)' in uuid.hpp is raised by header <boost/algorithm/string.hpp>. Please look into test: #include <boost/algorithm/string.hpp> #include <boost/uuid.hpp> int main( int argc, char *argv[]) { try { boost::uuid id("a74ac3b9-32d8-4f18-b292-05df553eda95"); return EXIT_SUCCESS; } catch ( std::exception const& e) { std::cerr << e.what() << std::endl; } catch (...) { std::cerr << "unhandled exception" << std::endl; } return EXIT_FAILURE; } /opt/boost/include/boost-1_34/boost/uuid.hpp:210: instantiated from 'void boost::uuid::construct(const std::basic_string<_CharT, _Traits, _Alloc>&) [with ch = wchar_t, char_traits = std::char_traits<wchar_t>, alloc = std::allocator<wchar_t>]' /opt/boost/include/boost-1_34/boost/uuid.hpp:84: instantiated from here /opt/boost/include/boost-1_34/boost/uuid.hpp:469: error: no matching function for call to 'find(wchar_t [16], wchar_t* const&, wchar_t&)' Oliver

Hi, uuid is using std::find without qualification and so it conflicts with boost::find declared in the string_algo. Looking through the uuid.hpp code, there are lots of 'using namespace' directives. Althoug they are only local, they could cause problems, especialy in the scope of boost. Regards, Pavol. Oliver.Kowalke@qimonda.com wrote:
Hi, I found that the error no matching function for call to 'find(wchar_t [16], wchar_t* const&, wchar_t&)' in uuid.hpp is raised by header <boost/algorithm/string.hpp>. Please look into test:
#include <boost/algorithm/string.hpp> #include <boost/uuid.hpp>
int main( int argc, char *argv[]) { try { boost::uuid id("a74ac3b9-32d8-4f18-b292-05df553eda95"); return EXIT_SUCCESS; } catch ( std::exception const& e) { std::cerr << e.what() << std::endl; } catch (...) { std::cerr << "unhandled exception" << std::endl; }
return EXIT_FAILURE; }
/opt/boost/include/boost-1_34/boost/uuid.hpp:210: instantiated from 'void boost::uuid::construct(const std::basic_string<_CharT, _Traits, _Alloc>&) [with ch = wchar_t, char_traits = std::char_traits<wchar_t>, alloc = std::allocator<wchar_t>]' /opt/boost/include/boost-1_34/boost/uuid.hpp:84: instantiated from here /opt/boost/include/boost-1_34/boost/uuid.hpp:469: error: no matching function for call to 'find(wchar_t [16], wchar_t* const&, wchar_t&)'
Oliver _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

uuid is using std::find without qualification and so it conflicts with boost::find declared in the string_algo.
Qualified both find invokations with std:: - now it's working
Looking through the uuid.hpp code, there are lots of 'using namespace' directives. Althoug they are only local, they could cause problems, especialy in the scope of boost.
So they should prefented in general? Oliver

Oliver.Kowalke@qimonda.com wrote:
uuid is using std::find without qualification and so it conflicts with boost::find declared in the string_algo.
Qualified both find invokations with std:: - now it's working
Looking through the uuid.hpp code, there are lots of 'using namespace' directives. Althoug they are only local, they could cause problems, especialy in the scope of boost.
So they should prefented in general?
When you are writting a general purpose library like the one for boost, it is very dangerous to use unqualified calls to other namespaces unless you know what you are doing. You cannot predict in what environment will be your library used. Regards, Pavol.

Pavol Droba <droba@topmail.sk> wrote in news:465FCB55.2080106@topmail.sk:
Oliver.Kowalke@qimonda.com wrote:
uuid is using std::find without qualification and so it conflicts with boost::find declared in the string_algo.
Qualified both find invokations with std:: - now it's working
Looking through the uuid.hpp code, there are lots of 'using namespace' directives. Althoug they are only local, they could cause problems, especialy in the scope of boost.
So they should prefented in general?
When you are writting a general purpose library like the one for boost, it is very dangerous to use unqualified calls to other namespaces unless you know what you are doing.
You cannot predict in what environment will be your library used.
Thank you for finding this! I thought it would be ok since they were local. I will remove all the 'using namespace' directives and unqualified function calls, and then upload a new version.
Regards, Pavol. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Thanks again, Andy.

Andy <atompkins@fastmail.fm> wrote in news:Xns99426893EB0Catompkinsfastmailfm@80.91.229.5:
Pavol Droba <droba@topmail.sk> wrote in news:465FCB55.2080106@topmail.sk:
Oliver.Kowalke@qimonda.com wrote:
uuid is using std::find without qualification and so it conflicts with boost::find declared in the string_algo.
Qualified both find invokations with std:: - now it's working
Looking through the uuid.hpp code, there are lots of 'using namespace' directives. Althoug they are only local, they could cause problems, especialy in the scope of boost.
So they should prefented in general?
When you are writting a general purpose library like the one for boost, it is very dangerous to use unqualified calls to other namespaces unless you know what you are doing.
You cannot predict in what environment will be your library used.
Thank you for finding this! I thought it would be ok since they were local. I will remove all the 'using namespace' directives and unqualified function calls, and then upload a new version.
Regards, Pavol.
Thanks again, Andy.
Uploaded a new version to the vault. uuid_v10.zip Andy.

On 6/1/07, Oliver.Kowalke@qimonda.com <Oliver.Kowalke@qimonda.com> wrote:
uuid is using std::find without qualification and so it conflicts with boost::find declared in the string_algo.
Qualified both find invokations with std:: - now it's working
Looking through the uuid.hpp code, there are lots of 'using namespace' directives. Althoug they are only local, they could cause problems, especialy in the scope of boost.
So they should prefented in general?
Oliver
There are a few teams at Adobe that have outlawed 'using namespace' (and 'using' in general). There is just too much code - being explicit helps you understand what's really going on. Tony
participants (4)
-
Andy
-
Gottlob Frege
-
Oliver.Kowalke@qimonda.com
-
Pavol Droba