提交 54c30e94 编写于 作者: B Behdad Esfahbod

[iter] Constrain hb_fill() and hb_copy()

上级 dc0a98cb
...@@ -194,15 +194,19 @@ struct hb_is_iterator_of { enum { ...@@ -194,15 +194,19 @@ struct hb_is_iterator_of { enum {
* Algorithms operating on iterators or iteratables. * Algorithms operating on iterators or iteratables.
*/ */
template <typename C, typename V> inline void template <typename C, typename V> inline
hb_enable_if_t (hb_is_iterable (C),
void)
hb_fill (C& c, const V &v) hb_fill (C& c, const V &v)
{ {
for (typename C::iter_t i (c); i; i++) for (typename C::iter_t i (c); i; i++)
hb_assign (*i, v); hb_assign (*i, v);
} }
template <typename S, typename D> inline bool template <typename S, typename D> inline
hb_copy (hb_iter_t<D> &id, hb_iter_t<S> &is) hb_enable_if_t (hb_is_iterator (S) && hb_is_iterator (D),
bool)
hb_copy (D id, S is)
{ {
for (; id && is; ++id, ++is) for (; id && is; ++id, ++is)
*id = *is; *id = *is;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册