Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #83572
| From | Ralf Goertz <me@myprovider.invalid> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | ambiguous reference to 'find' in std and std::ranges namespaces |
| Date | 2022-04-13 09:58 +0200 |
| Organization | A noiseless patient Spider |
| Message-ID | <t35vs1$8pu$1@dont-email.me> (permalink) |
Hi,
why do I get the error (with gcc-Version 11.2.1):
find_test.cc: In function ‘int main()’:
find_test.cc:10:41: error: reference to ‘find’ is ambiguous
10 | std::vector<int>::const_iterator it=find(v,47);
| ^~~~
when compiling the following code:
#include <algorithm>
#include <ranges>
#include <vector>
using namespace std; // *
using namespace std::ranges; // **
int main() {
const std::vector<int> v({47,11});
std::vector<int>::const_iterator it=find(v,47);
}
AFAICT there is no way that std::find could be a candidate whereas
std::ranges::find matches. This can also be seen by the fact that
commenting out the line marked * results in successful compilation but
commenting out ** instead leaves me with the error of no matching
function.
PS: Please don't bother to comment the "using namespace" directives,
these are not the point and I know they are frowned upon.
Back to comp.lang.c++ | Previous | Next — 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