Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7931073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T20:37:05+00:00 2026-06-03T20:37:05+00:00

The boost function make_function_output_iterator converts a function that would be appropriate for std::for_each into

  • 0

The boost function make_function_output_iterator converts a function that would be appropriate for std::for_each into an iterator appropriate for std::copy. Is there a boost function that does the reverse. That is, takes an iterator appropriate for std::copy and converts it to a function appropriate for std::for_each.

So if I have an output iterator output_iter. I need

for_each(v1.begin(), v1.end(), make_output_iterator_function(output_iter));

To do the same thing as

copy(v1.begin(), v1.end(), output_iter);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T20:37:07+00:00Added an answer on June 3, 2026 at 8:37 pm

    Maybe std::insert_iterator or std::transform are what you are looking for?

    You can bind std::insert_iterator::operator=, which does an insert on every invocation, with some boost::bind sorcery:

    #include <boost/bind.hpp>
    #include <vector>
    #include <iterator>
    #include <algorithm>
    
        typedef std::vector<int> Container;
        typedef std::insert_iterator< Container > InsertIt;
    
    int main(){
        Container v1, v2;
        InsertIt insert_it (v2,v2.end());
        std::for_each(v1.begin(), v1.end(),
                boost::bind(static_cast<InsertIt& (InsertIt::*)(typename Container::const_reference)>(&InsertIt::operator=), insert_it, _1));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Boost.Python, is there a way to call a Python function that's been passed
Is there a way to dereference a placeholder inside lambda expression ? boost::function<int(MyClass*)> f
All, I am trying to write a cross platform (hence: boost) method/function that will
I want to use boost::crc so that it works exactly like PHP's crc32() function.
I have compiled part of boost - the ibeta_inv function - into a .Net
I've been writing some templates that expect to be passed a boost::function. They determine
I am having trouble aliasing the function boost::make_iterator_range (I would like to hide boost
I've got a function that I want to take an optional boost::function argument as
template<typename T> Ref<Iterator<T> > GetFilterIterator(Ref<Iterator<T> > i, boost::function<bool(T)> pred) { return new FilterIterator<T>(i, pred);
I am trying to build a function that converts an item from an enum

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.