This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable



------- 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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]