Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #83582
| From | Bo Persson <bo@bo-persson.se> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: ambiguous reference to 'find' in std and std::ranges namespaces |
| Date | 2022-04-14 13:23 +0200 |
| Message-ID | <jbqehlFko73U1@mid.individual.net> (permalink) |
| References | (1 earlier) <t36c3i$dpq$1@dont-email.me> <t36j2i$10a3$1@gioia.aioe.org> <t36j5k$10a3$2@gioia.aioe.org> <t38aik$me1$1@dont-email.me> <t38gk5$lev$1@dont-email.me> |
On 2022-04-14 at 08:57, Ralf Goertz wrote: > Am Thu, 14 Apr 2022 07:13:55 +0200 > schrieb Christian Gollwitzer <auriocus@gmx.de>: > >> Am 13.04.22 um 15:28 schrieb Juha Nieminen: >>> Juha Nieminen <nospam@thanks.invalid> wrote: >>>> Paavo Helde <eesnimi@osa.pri.ee> wrote: >>>>> In my implementation it appears to be implemented as a function >>>>> object, having operator() member functions. I guess the problem >>>>> is caused by this specific implementation, as the whole point of >>>>> niebloids seems to be the opposite (avoiding clashes with the >>>>> std:: namespace). >>>> >>>> Perhaps a minimal example that replicates the mentioned behavior >>>> could illuminate if this is normal to-be-expected behavior, a >>>> problem with the library implementation, or perhaps even a problem >>>> with the compiler itself. >>> >>> (I mean a minimal example that doesn't use the standard library, >>> ie. a piece of code that itself demonstrates what's happening inside >>> the library for this error to happen.) >> >> Maybe the second example in this answer is helpful: >> >> https://stackoverflow.com/a/62929027 > > I have to admit that I am now more confused than before. Is the lookup > problem in my OP a bug or not? And if not and the niebloids are there to > avoid clashes why don't they do their job in my case? The first example > in the cited answer is equivalent to > > find(begin(v), end(v), 47) > > in my OP. This works with either "using" directive but not both which I > understand since the iterator variant of find is declared in both. But > with my original "find" there should be no clash since nothing in std:: > matches. > The niebloids suppress ADL by not being functions. Only functions have overloads to be resolved. The name "find" is present in the code, not by being found by ADL, but by being explictly brought in by the "using namespace" directives. To do an overloads resolution (to see if anything "matches"), the compiler *first* collects eveything with the correct name, and *then* tries to see if one overload is better than all the others. Only then does it consider the types and numbers of parameters. Now, with the niebloid in the set, this all fails as one of the "find" items is not a function. And only functions have overloads. So we seem to have found another reason for why "using namespace std;" is ungood.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
ambiguous reference to 'find' in std and std::ranges namespaces Ralf Goertz <me@myprovider.invalid> - 2022-04-13 09:58 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Paavo Helde <eesnimi@osa.pri.ee> - 2022-04-13 14:27 +0300
Re: ambiguous reference to 'find' in std and std::ranges namespaces Bo Persson <bo@bo-persson.se> - 2022-04-13 14:21 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Paavo Helde <eesnimi@osa.pri.ee> - 2022-04-13 15:31 +0300
Re: ambiguous reference to 'find' in std and std::ranges namespaces Juha Nieminen <nospam@thanks.invalid> - 2022-04-13 13:26 +0000
Re: ambiguous reference to 'find' in std and std::ranges namespaces Juha Nieminen <nospam@thanks.invalid> - 2022-04-13 13:28 +0000
Re: ambiguous reference to 'find' in std and std::ranges namespaces Paavo Helde <eesnimi@osa.pri.ee> - 2022-04-13 17:26 +0300
Re: ambiguous reference to 'find' in std and std::ranges namespaces Christian Gollwitzer <auriocus@gmx.de> - 2022-04-14 07:13 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Ralf Goertz <me@myprovider.invalid> - 2022-04-14 08:57 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Bo Persson <bo@bo-persson.se> - 2022-04-14 13:23 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Paavo Helde <eesnimi@osa.pri.ee> - 2022-04-14 16:32 +0300
Re: ambiguous reference to 'find' in std and std::ranges namespaces Bo Persson <bo@bo-persson.se> - 2022-04-14 18:30 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Ralf Goertz <me@myprovider.invalid> - 2022-04-15 10:14 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Manfred <noname@add.invalid> - 2022-04-14 15:02 +0200
Re: ambiguous reference to 'find' in std and std::ranges namespaces Christian Hanné <the.hanne@gmail.com> - 2022-04-15 14:39 +0200
csiph-web