Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Daniel Krügler<daniel.kruegler@googlemail.com> |
|---|---|
| Newsgroups | comp.std.c++ |
| Subject | Re: Defect Report: Attitude to overloaded comma for iterators |
| Date | 2012-02-09 10:07 -0800 |
| Organization | A noiseless patient Spider |
| Message-ID | <4F33C66B.1050801@googlemail.com> (permalink) |
| References | <2ad44743-d84f-41f0-9d69-5a3505c76430@dp8g2000vbb.googlegroups.com> <CAO=tXLCwsrmfXuyT5rn_XF4pccp-H7+SwViSgpM8b4RLzqaPKg@mail.gmail.com> <CAO=tXLC9D0_pCNF51VQYfhneVkswk=zX5Bx8reoBopPO=ivpMg@mail.gmail.com> |
On 2012-01-25 08:30, Yakov Galka wrote: > [global.functions] says: > >> Unless otherwise specified, global and non-member functions in the standard library shall not use functions from another namespace which are found through argument-dependent name lookup (3.4.2). > > This sounds clear enough. There are just two problems: > > 1. Both implementations I tested (VS2005 and GCC 3.4.3) do unqualified > calls to the comma operator in some parts of the library with operands > of user-defined types. > > 2. The standard itself does this in the description of some > algorithms. E.g. uninitialized_copy is defined as: > >> Effects: >> for (; first != last; ++result, ++first) >> ::new (static_cast<void*>(&*result)) >> typename iterator_traits<ForwardIterator>::value_type(*first); > > If understood literally, it is required to call operator, > (ForwardIterator, InputIterator). > > For detailed discussion with code samples see > http://stackoverflow.com/questions/8719829/should-the-implementation-guard-itself-against-comma-overloading. > > Proposal: > > 1. Add an exception to the rule in [global.functions] by permitting > the implementation to call the comma operator as much as it wants to. � > I doubt we want this. or > > 2. Fix the description of the said algorithms and perhaps add a note > to [global.functions] that brings attention of the implementers to > avoid this pitfall. > > Sincerely > Yakov Galka This issue has been forwarded to the LWG working group. Greetings from Bremen, Daniel Krügler -- [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Find similar
Defect Report: Attitude to overloaded comma for iterators Yakov Galka <ybungalobill@gmail.com> - 2012-01-24 23:30 -0800 Re: Defect Report: Attitude to overloaded comma for iterators Daniel Krügler<daniel.kruegler@googlemail.com> - 2012-02-09 10:07 -0800
csiph-web