equals() from boost/algorithm/string.hpp in top namespace?
Hi,
Why is equals() in the top namespace in 1.33.1?
#include
Hi, It is not and it has never been there. I assume, that in your example argument dependent lookup took a place. Since boost::array is in the boost namespace, this namespace is also searched when you use unqualified call to equals. And equals as well as many other algorithms is pulled to boost namespace via "using" directive. Therefore it is found. Best regards, Pavol. Olaf van der Spek wrote:
Hi,
Why is equals() in the top namespace in 1.33.1?
#include
#include int main() { boost::array
a = { 1, 2, 3, 4 }; equals(a, a); return 0; } _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
On 3/9/07, Pavol Droba
Hi,
It is not and it has never been there. I assume, that in your example argument dependent lookup took a place.
You're right. I thought about that later too. I'm not that familiar with it and it's a bit confusing, especially with a generic function like equals.
Since boost::array is in the boost namespace, this namespace is also searched when you use unqualified call to equals.
And equals as well as many other algorithms is pulled to boost namespace via "using" directive. Therefore it is found.
Best regards, Pavol.
Olaf van der Spek wrote:
Hi,
Why is equals() in the top namespace in 1.33.1?
#include
#include int main() { boost::array
a = { 1, 2, 3, 4 }; equals(a, a); return 0; } _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
Olaf van der Spek
Hi,
Why is equals() in the top namespace in 1.33.1?
#include
#include int main() { boost::array
a = { 1, 2, 3, 4 }; equals(a, a); return 0; }
To determine if it /really/ is the top namespace, use ::equals(a,a); This should be rejected, since it blocks the normal name lookup rules.
participants (3)
-
bryane
-
Olaf van der Spek
-
Pavol Droba