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 7806323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:29:51+00:00 2026-06-02T02:29:51+00:00

My question is pretty straightforward: can I do something like this? Say class foo

  • 0

My question is pretty straightforward: can I do something like this?

Say class foo contains the following member function:

foo foo::DoSomething(input_type1 input1, input_type2 input2)
{
    ... // Adjust private datamembers
    return *this;
}

Using foo:

std::vector<foo> foovec;
input_type1 in1;
input_type2 in2;
...
std::transform(foovec.begin(), foovec.end(), foovec.begin(), std::mem_fun_ref(boost::bind(&foo::DoSomething, in1, in2)));

So is this possible? The issue is pretty much whether boost::bind() has an effect on the member/nonmember nature of the function it works on. I reckon I can’t go about it the other way around like this:

std::transform(foovec.begin(), foovec.end(), foovec.begin(), boost::bind(std::mem_fun_ref(&foo::DoSomething), _1, in1, in2)));

because std::mem_fun_ref() takes a unary or nullary function and DoSomething() is binary.

  • 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-02T02:29:53+00:00Added an answer on June 2, 2026 at 2:29 am

    You don’t need std::mem_fun_ref, just use:

    std::transform(foovec.begin(),
                   foovec.end(),
                   foovec.begin(),
                   boost::bind(&foo::DoSomething, _1, in1, in2));
    

    or you could replace boost::bind with

    std::bind(&foo::DoSomething, std::placeholders::_1, in1, in2)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This seems like a pretty straightforward question but I haven't been able to find
My question is pretty straightforward. How to create a transitional scroll which looks like
This is probably (hopefully) a pretty simple question, but I can't seem to get
This is a pretty straightforward architectural question, however it's been niggling at me for
Pretty straightforward question. Can it be done without the use of Ants or Maven?
It's a pretty straightforward question but I can't find very good documentation on the
Well, first of all sorry about this question it must be pretty straight forward
my question is pretty simple: can PHP and Java communicate, while PHP being the
I've got a sub-select in a query that looks something like this: left outer
This is a follow-up to a question I posted a while back: Can I

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.