templates - C++ error: 'iterator is not a type' -
templates - C++ error: 'iterator is not a type' -
here's code:
template <typename container_type> void transfer(container_type container, iterator begin, iterator end) { (; begin != end; begin++) if (!element_in_container(container, *begin)) container.insert(iterator, *begin); }
i error 'iterator not type'
.
i tried adding std::
or container_type::
before iterator
, didn't help. tried defining template template <typename container_type<typename t> >
, iterators container_type<t>::iterator
, no luck. what's wrong?
i think mean following
template <typename container_type> void transfer( container_type container, typename container_type::iterator begin, typename container_type::iterator end) {
take business relationship in case function wrong because after inserting element in container iterators can invalid.
c++ templates
Comments
Post a Comment