This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
- From: "chris at bubblescope dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 Jan 2006 17:00:50 -0000
- Subject: [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
- References: <bug-25306-1186@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from chris at bubblescope dot net 2006-01-10 17:00 -------
For the record, I was thinking of:
template<typename _OutputIterator, typename _Size, typename _Tp>
_OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
{
iterator_traits<_OutputIterator>::difference_type __count(__n)
for (; __count > 0; --__count, ++__first)
*__first = __value;
return __first;
}
But now I've decided thats no good, as difference_type isn't designed for
OutputIterators. Sorry.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306