This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/22634] partial_sum is too constrained
- From: "squell at alumina dot nl" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Jul 2005 14:01:45 -0000
- Subject: [Bug libstdc++/22634] partial_sum is too constrained
- References: <20050723200746.22634.squell@alumina.nl>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From squell at alumina dot nl 2005-07-25 14:01 -------
(In reply to comment #13)
> I've attached the work-around I personally use to this kind of problem, which is
> wrapping the iterator in another iterator which changes the value_type.
I tried this approach as well :) I called it a 'cast_iterator'. However,
writing a full iterator class is involved, especially if you don't want to
restrict the iterator class to 'input_iterator_tag'.
Second, I felt it was 'writing to the implementation'. I know that libstdc++
uses the 'value_type' to determine the type, but this doesn't mean other
implementations use it! In the end, it is a non-solution.
If you've want the non-expanding behaviour, this will always be possible by
simply using a function object. For example;
std::partial_sum(begin, end, std::plus<char>())
This is *guaranteed* not to expand.
~Marc.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22634