#ifndef CH_2_HPP #define CH_2_HPP #include #include #include namespace _cg { template OutputIter ch_2(InputIter ifirst, InputIter ilast, OutputIter ofirst) { typedef std::iterator_traits ITraits; typedef typename ITraits::value_type value_type; if (ifirst == ilast) return ofirst; // No elements std::vector V; std::copy(ifirst, ilast, std::back_inserter(V)); typename std::vector::iterator Vit = V.begin(); while(Vit != V.end()){ *ofirst = *Vit; ++ofirst; ++Vit; } return ofirst; } }; // namespace ends here #endif // ch_2.hpp